Use the filter function to filter qualified DOM elements from the wrapper set.
If we have an html file with the following content, we can easily get the element with class external by using filter.
The parameter types of filter can be divided into There are two types:
1 Pass the selector
2 Pass the filter function
If you use the selector as a parameter, the usage is as follows
$('a').filter('.external')
Use the anonymous filter function
$('a').filter (function(index) {
return $(this).hasClass('external');
})
The parameter index is the subscript of the result set.
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