javascript - How to check a text in HTML content using jQuery? -


i want check particular word/text in html content using jquery. eg: let html content be

 <p>i love stackoverflow</p> 

so how can check & highlight sentence if contains word 'love'?

thanks in advance. :)

you can use jquery.contains()

$(document).ready(function(){   $("p:contains('love')").css("background-color","red"); }); 

hope helps!!!


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -