Using a searchbox, you can enter words to find pages with the searched-for word in the page description. If the word is found in the description, a link to the page along with the highlighted word will be displayed. However, I am encountering an issue where the entered word is not being highlighted in the description as intended.
var searchValue = $(".search-query").val(); // The value entered in the search box
$( ".searchResults-description:contains('" + searchValue + "')").css("background-color", "#fadcd9" );
I am seeking assistance to resolve this issue. After clicking the search button, the word remains in the search box. While I have been able to re-enter the word after reloading the page, I now need it to be properly highlighted within the description section whenever it appears.