[jquery filter is (expr | jqobj | ele | function)] This method is used to detect a collection of matching elements based on selectors, Dom elements, or jquery objects, if any, on top of the selector, and returns true if any

Source: Internet
Author: User

Detects a collection of matching elements based on a selector, DOM element, or JQuery object, and returns true if at least one of the elements conforms to the given expression.

Returns ' false ' if no element is met, or if the expression is not valid. "Note:" in jquery 1.3, all expressions are supported. In previous releases, a complex expression, such as a hierarchy selector (such as +, ~ and >), would always return true

Instance:

<! DOCTYPE html>    $(function(){        /*This function returns a Boolean value, and now we know that a filter that can return a Boolean value has two Hasclass (Class) | is (expr | jqobj | ele | function); */        $(' Li '). Click (function(index) {varBOOL = $ ( This). Is (function(index) {return$ (' strong ', This). Size () = = 2;           }); if(BOOL) {$ ( This). css ({' Background ': ' Red ', ' color ': ' #000 ', ' cursor ': ' pointer '),}); }Else{               $( This). css ({' Background ': ' Green ', ' color ': ' #FFF ', ' cursor ': ' pointer '),});            }        }); });</script>

[jquery filter is (expr | jqobj | ele | function)] This method is used to detect a collection of matching elements based on selectors, Dom elements, or jquery objects, if any, on top of the selector, and returns true if any

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.