SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    250
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Highlight search terms

    Hi,

    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?

    Mike

  2. #2
    Avid Logophile silver trophy
    ParkinT's Avatar
    Join Date
    May 2006
    Location
    Central Florida
    Posts
    2,337
    Mentioned
    192 Post(s)
    Tagged
    4 Thread(s)
    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.
    Don't be yourself. Be someone a little nicer. -Mignon McLaughlin, journalist and author (1913-1983)


    Git is for EVERYONE
    Literally, the best app for readers.
    Make Your P@ssw0rd Secure
    Leveraging SubDomains

  3. #3
    SitePoint Addict
    Join Date
    May 2006
    Posts
    250
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure how I would do that without hacking the software.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •