Highlight search terms


I want to highlight searched terms on a search results page.

Currently the main instance of the search term is wrapped with a span with a class of ‘terms’ (but the rest are dynamic) so I need to…

  • Grab the contents of span.terms
  • Find that term within the copy of dl#results
  • wrap each one in <mark> tags.

Can someone assist please?


Since the content is generated dynamically, I would simply add a “span” tag with a “class” (like .highlight) as the content is being generated.
Then you simply use CSS to affect the appearance of all the terms.

Not sure how I would do that without hacking the software.