I want to highlight all the keywords (case insensitive) within a p tag programatically
if the keywords are
var keywords = 'hello,thanks, goodbye' // this should be an array <p>hello world</p>
hello should be highlighted in blue
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you are looking for the jQuery highlight plugin.
Once you have it loaded, you can just do something like this:
Where
selectoris what element in the document you want to look for. If you want it to be done to the entire page, just put'body'.