• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Highlight the search keyword

 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys,

I'm developing a Search functionality in a page where in I need to highlight the search keyword criteria.
Could somebody please explain me how to achieve this/point me to good examples.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apply CSS styles to the highlighted text.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking about how to highlight (display style) or how to locate the words in the text in the first place (parsing) in order to apply the style.

Bill
 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Guys.

Yes Bill, I would like to know how to locate the words in the text and then how to highlight them.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

I was thinking about doing the same thing, although I haven't got round to implementing it. I would use a Regular Expression to find the work you are searching for capture it and replace with the same text surrounded by some kind of css class: e.g.


Then add some style to highlight.

Sean
 
Soumya Manjunath
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.Let me try that!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic