javascript - How can I quickly count occurrences of a string on a webpage? -
Looking at a local URL, how quickly do I get the number of string Example: For given URL: How often can this code be on Answer: You can do this in Konsole or in JavaScript on the page: abc on the page Can I count using javascript and / or jquery?
ABC (case insensitive)?
< Code> $ ("*"). Html () Match (/ abc / gi) This will get you just text nodes on the page *:
var count = 0; $ ("Body") Content () Return to filter (function () {this.nodeType == 3} each (function () {var match = this.wholeText.match (/ abc / gi); if (match) count = match = lang;});
Comments
Post a Comment