Adding a search background for search results
I am trying to add a background color to a custom search result when the user enters a search term on a page (which is basically one big table). This is a text search. I am using jquery to show / hide table rows that do not have a search term like text in TR, but I would ideally like to take an extra step of searching (the value entered) and match any of those text terms in the remaining (ostentatious) rows and adding , for example, a yellow background to the word (s). I know my syntax is currently not right, just not sure which is correct :) Hope this is clear ... any help is greatly appreciated!
html forms:
JQuery: $ ("# searchsubmit"). click (function () {var searchexp = document.getElementById ('searchbox'). value; $ ("table tr"). hide (); $ ("table tr.header"). show (); $ ('tr : contains ('+ searchexp +') '). show (); $ (Searchexp) .css (' background color ',' yellow ');});
a source to share
No one has answered this question yet
Check out similar questions: