jquery-Edit Selection results (add, filter, filter, or detect)

Source: Internet
Author: User

Edit Selection Results
Operation Instance Effect Note

Add to

Add Selector $ ("P"). Add (". a") To add a selector with the class name a Does not affect the source result set
$ ("P"). Add ("Label", $ (". Class")); Add class contains selectors for all label elements named class
Adding HTML objects $("P"). Add( document. getElementsByTagName("label")) Add an HTML object with an element name of label
Add a JQuery Object $ ("P"). Add ($ ("strong")) Add a jquery object with an element named Strongl

Screening

Get element $ ("P"). First () Gets the first element
$ ("P"). Last () Gets the last element
$ ("P"). EQ (3) Gets the 3rd element can be negative, table countdown
Get subset $ ("P"). Slice (2) Gets the result set of the 2nd element up to the end of the result set
$ ("P"). Slice (2,5) Get a result set consisting of 第2-5个 elements

Filter

Current

Get the corresponding element $ ("P"). Filter (". AA") Get a result set containing the class name AA
$ ("div"). Filter (document. getElementsByTagName("label")) Get the result set that contains the LABEL element
$ ("div"). Filter ($test) Get the result set containing the $test object
$ ("div"). Filter (function (index) {if (this.id== "Xixi") {return true;} Else{return false;}} ) Traverse result set, get false return value to reject Index is indexed, this represents the current object
Remove the corresponding element $ ("P"). Not (". AA") Just the opposite of filter
$ ("div"). Not (document. getElementsByTagName("label"))
$ ("div"). Not ($test)
$ ("div"). Not (function (index) {})

later generation

Get the result set containing the descendant elements that match the criteria

$ ("div"). has (". AA") Descendants contain a result set with the class name AA The object that is judged is the descendant element
$ ("div"). has (document. getElementsByTagName("label")) Descendants contain a result set with the element name label
Detection Returns TRUE or False $ ("#div1"). Is ("div") Returns True when the parameter is the parent set of the source result set
$ ("#div1"). Is (document. getElementsByTagName("div"))
$ ("#div1"). Is ($test)
$ ("#div1"). Is (function (index) {if (this.id== "Xixi") {return true;} Else{return false;}}) Index is indexed, this represents the current object

Reference: http://www.365mini.com/page/jquery-add.htm

jquery-Edit Selection results (add, filter, filter, or detect)

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.