+ 4
How to calculate <p> tag words?
I want to calculate p tag words, that how many words in p element through javascript any one guide me ??
3 RĂ©ponses
+ 6
can also use length property with
var pCount =
document.querySelectorAll("P").length;
+ 1
document.querySelector(#theptagid).innerHTML.split(" ").length
+ 1
https://code.sololearn.com/WtPVY7XQwjNf/?ref=app
tried it out
thanks to Antoine Bergerault
Have a nice day đ