reading time with jquery

Solutions on MaxInterview for reading time with jquery by the best coders in the world

showing results for - "reading time with jquery"
Ilaria
25 Feb 2019
1$(function () {
2    var txt = $(".content").text();
3    
4    wordCount = txt.replace( /[^\w ]/g, "" ).split( /\s+/ ).length;
5
6    var readingTimeInMinutes = Math.floor(wordCount / 228) + 1;
7    var readingTimeAsString = readingTimeInMinutes + " min";
8    
9    $('article .reading-time').html(readingTimeAsString);
10});
11