jquery Traversal method

Source: Internet
Author: User

Sibling relationship of a parent-child, sibling relationship: Look up 1. Prev (filter): Look up the peer first Selector.prev (filter): For example $ ("#id"). Prve ("div") looking up for a sibling of a Div 2.prevAll (Filter): Look up all of the sibling elements Selector.prveall (filter): For example $ ("#id"). Prevall ("TD") upward all-peers TD element 3.prevUntil (Stop,Filter): Finds the sibling element Selector.prevuntil (stop,filter) between the specified elements: for example, $ ("#id"). Privuntil ("#Id1", "TD"): Find all sibling TD elements from #id to #id1 up Sibling relationship: Look down 1.next (filter): Find the first sibling Selector.next (filter): For example, $ ("#id"). Next ("TD"): Look up the first TD element of the peer 2.nextAll (Filter): Look down all the elements of the sibling 3.nextUntil (Stop,filter): Finds all siblings between the specified elements in the sibling relationship: peer-to find 1.sibliings (filter): Find all of the sibling elements selector.siblings (): Find all of the sibling elements selector.siblings ("TD"): Find all the peers of the TD element Parent relationship: 1.parent (filter): Find the first Direct parent element $ (". Mini"). Parent ("Li.one") Find the immediate parent element for all Class=.mini and the parent element Class=one 2.parents (filter): All ancestor Elements 3.offsetParent (): The first parent element to be set to 4.closest (filter) : The ancestor-element child relationship of the first specified attribute children (Filter): Find the direct child element Selector.childer (filter): $ ("#div"). Children ("TD") looking for #div all tags for TD's child element two. Filter 1.find : The element of the specified property is searched down 2.filter (criteria,function (index)): Filters The specified collection of elementscriteria: A label that a condition can specify function (index): Iterates over the elements in the collection and returns true to preserve
$ ("TD"). Filter (". Mini", function () {return $ ("span", this). length==2;//the number of descendants in the current element is 2, preserving the current TD element}) 3.has (filter): Returns the collection of elements with the specified attributes 4.is (filter): Selector.is (": Checked") selected element 5.not (filter): $ ("TD"). Not (". Mini") All TD elements drain Class=mini Element 6.first (): Returns the first element in the collection, 7.last (): Returns the last element in the collection, 8.eq (index): Returns the element in the collection equal to the specified index, 9.contents (filter) $ (" #div "). Contents (" Li ") all DIV elements that contain the text Li in the Div. 10.slice (start,stop) specifies that the index starts, the specified index ends, and can be a negative three-cycle each (function (index, Element) {}): Iterates over the collection, executes the callback function map (function (index,element)): Iterates over the collection, executes the callback function, and needs to put back the new jquery object $ ("TD"). Map (function (index, Element) {return this.id;}).  Join (', '); Four other Add (): Adds the specified element to the specified collection of elements $ ("#id"). Add ("P"). Add ("span"); end (): Returns the previous jquery object after filtering

jquery Traversal method

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.