This article illustrates the way jquery uses contains filters to achieve exact matching. Share to everyone for your reference, specific as follows:
: The contains selector selects the element that contains the specified string.
The string can be text that is directly contained in an element, or is contained in a child element.
Often used with other elements/selectors to select elements in the specified group that contain the specified text, such as:
$ ("P:contains (IS)") indicates that all <p> elements that contain "is" are selected.
Another example:
$ ("P:contains (John)") or $ ("P:contains (" John) ") indicates that all <p> elements that contain" John "are selected.
Variables can also be used in the selector to achieve the purpose of the selection, such as:
$ (document). Ready (function () {
var ddd= "John";
$ ("div:contains (' + ddd + ')"). CSS ("Color", "#f00");
We can also use the jquery filter method and the contains method to achieve a more ambiguous match, such as:
$ (document). Ready (function () {
$ (". Box"). Filter (": Contains (Lee)"). CSS ("Color", "#f00");
});
Indicates that the text color of box containing "Lee" is set to red.
jquery uses contains filters to achieve exact matches:
More about jquery-related content readers can view the site topics: "jquery drag-and-drop effects and tips summary", "JQuery Extended Skills Summary", "jquery common Classic Effects Summary", "jquery animation and special effects usage Summary" and "jquery Selector usage Summary 》
I hope this article will help you with the jquery program design.