Analysis of the use of filter () function and find () function in jquery

Source: Internet
Author: User

The example in this article describes the use of the filter () function and the Find () function in jquery. Share to everyone for your reference. The specific analysis is as follows:

$ ("Div. cont");

Equivalent to $ ("div"). Find (". Cont")

The filter () function is the function of each object in the collection (what is here, what is obtained).

The Find () function is a child element that finds a matching expression inside each object

Example:

?

1 2 <div class= "cont" ><P class= "cont" >asdf</p></div> <div><p class= "cont" >jldf< /p></div>

The code is as follows:

$ ("div"). Filter (". Cont")//Gets the

The label

Indicates that a DIV element with class cont is found

The code is as follows:

$ ("div"). Find (". Cont")/Get the

The label

After finding the div, find the element with class as cont inside the DIV's child elements

I hope this article will help you with your jquery programming.

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.