I have a searchbox where you can search for words and pages will display with the searched-for word in the description of the page(meaning if the word you searched for is in the description of the page then it will display a link to the page and the description of the page). I need to be able to take the word searched-for and from the description that is displayed in the result, I need that word highlighted in the description. Here is what I have so far. But this is not working.
var searchValue = $(".search-query").val(); //searchValue is the word you type in the input box
$( ".searchResults-description:contains('" + searchValue + "')").css("background-color", "#fadcd9" );
please help! When I click search the word stays in my searchbox. I slapped it back in the input box after page reload. but not I need this word to be highlighted in the description div, whereever this word shows up in it.