We will use jQuery to highlight a word entered by the user. The data on the browser can be made available from the server side (or database) as well. For this example, we will use some text in an HTML page. The user will enter a search query in a textbox and after pressing a button all matching words in the content will be highlighted.
Create a folder for this recipe in the
Chapter5 directory and name it as
index.htmland save it in the
Recipe2folder. Let us begin by writing the markup now. Create some paragraphs and put some text inside them. In the end, place a textbox and two buttons. We have also defined a CSS class