Home  >  Article  >  Web Front-end  >  jQuery how to find element by text

jQuery how to find element by text

anonymity
anonymityOriginal
2019-05-24 14:08:534227browse

jQuery can use the :contains() selector to find elements by looking for text content.

jQuery how to find element by text

:contains() The selector selects elements that contain the specified string.

The string can be text contained directly in the element, or contained in a child element.

The most common usage: used with other selectors to select elements that contain specified text in a specified combination (such as the example above).

Note: Text is case-sensitive.

Syntax

$(":contains(text)")

Parameter text is required and specifies the text to be found.

The above is the detailed content of jQuery how to find element by text. For more information, please follow other related articles on the PHP Chinese website!

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
Previous article:What does var in js mean?Next article:What does var in js mean?