+ 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 ??

6th Feb 2018, 8:54 PM
Nabeel Nasir
Nabeel Nasir - avatar
3 Respostas
+ 6
can also use length property with var pCount = document.querySelectorAll("P").length;
6th Feb 2018, 10:41 PM
Morpheus
Morpheus - avatar
+ 1
document.querySelector(#theptagid).innerHTML.split(" ").length
6th Feb 2018, 9:25 PM
Αητοιπe
Αητοιπe - avatar
+ 1
https://code.sololearn.com/WtPVY7XQwjNf/?ref=app tried it out thanks to Antoine Bergerault Have a nice day 👍
6th Feb 2018, 9:37 PM
Sebay
Sebay - avatar