Home >Web Front-end >JS Tutorial >How to use jQuery contains filter to achieve exact matching_jquery

How to use jQuery contains filter to achieve exact matching_jquery

WBOY
WBOYOriginal
2016-05-16 17:37:181324browse

Copy code The code is as follows:



















$(".selector:contains('xx')")
contains() only performs matching search, which is not accurate enough. It contains the selector and xx of xx All selectors containing xxabc will be found.

Solution:
?$(".selector:contains('xx')[innerHTML='xx']")
This will find the selector whose content is only xx.
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