Home  >  Article  >  Backend Development  >  javascript - Website search keyword problem

javascript - Website search keyword problem

WBOY
WBOYOriginal
2016-08-18 09:16:18994browse

If you want to conduct a keyword search on the website, if you see some search keywords in some websites on the Internet, you can make the keywords red and bold, so that users can clearly see at a glance which content contains the search keywords. I would like to ask all the experts, is there any js or css settings that can achieve such a function?

Reply content:

If you want to conduct a keyword search on the website, if you see some search keywords in some websites on the Internet, you can make the keywords red and bold, so that users can clearly see at a glance which content contains the search keywords. I would like to ask all the experts, is there any js or css settings that can achieve such a function?

It means setting a label for the keyword based on the keyword entered by the user, setting the color and font for the label, and replacing the keyword in the search results. I have used a js plug-in before. Please refer to it. It works fine for me. highlight

Replace with regular expressions

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn