Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Reading Time with jquery

$(function () {
    var txt = $(".content").text();
    
    wordCount = txt.replace( /[^w ]/g, "" ).split( /s+/ ).length;

    var readingTimeInMinutes = Math.floor(wordCount / 228) + 1;
    var readingTimeAsString = readingTimeInMinutes + " min";
    
    $('article .reading-time').html(readingTimeAsString);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: drupal 8 check if current page is node 
Javascript :: js remove item from array by value 
Javascript :: javascript add listeners to class 
Javascript :: run a code after delay js 
Javascript :: File type node js 
Javascript :: javascript quicksort 
Javascript :: any click event jquery 
Javascript :: react js create element 
Javascript :: js addeventlistener hover 
Javascript :: react history go back 
Javascript :: html button javascript void 
Javascript :: js read from json2 
Javascript :: new gatsby project 
Javascript :: find longest word in string javascript 
Javascript :: get if user signed in firebase 
Javascript :: discord.js arguments 
Javascript :: element ui handle enter key 
Javascript :: how to add background image in mui 
Javascript :: useeffect hook react 
Javascript :: remove property from javascript object 
Javascript :: agregar clase en jquery 
Javascript :: express.static 
Javascript :: validate password regex 
Javascript :: js two array combining with id 
Javascript :: react native text get number of lines 
Javascript :: iframe innerthtml 
Javascript :: jquery if .val is blank 
Javascript :: what is the meanof using next in nodejs 
Javascript :: jquery get data attribute 
Javascript :: javascript assignment operators 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =