Here is the code:
var textRange = document.body.createTextRange();
<p id="p">All glitters are not gold</p>
<input type="button" value="Search" onclick="Search()"/>
Output will be displayed as:
The above code searches the 'glitters' from the specified text and highlights it. Therefore, on clicking the button, you will get the following:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.