jquery Selector Detailed

Source: Internet
Author: User

first, the basic selector#Box.box1div$ ("#box, Box1."); second, level selector $ ("Div p");//all the P in the Div$ ("div > P");//Sub-element p in Div$ ("div + P");//the first p at the back of a div$ ("div~p");//all the p behind the Divthree, basic filter selector $ ("P:first");//the first of the P tags$ ("P:last");//last one$ ("P:not (. p)");//Not class= p label for "P"$ ("P:even");//Subscript is even, subscript starting from 0, interlaced color change$ ("p:odd");//Subscript is odd$ ("P:eq (5)");//Subscript = 5 label, eq=equal$ ("P:GT (3)");//Subscript > 3$ ("P:lt (3)");//Subscript < 3$(": Header");//: The header is the abbreviation of H1~H6, matching all the H1~h6iv. content and Visibility selector $ ("P:contains (line)");//Match all P tags that contain line to the P tag content, do a search$ ("P:empty"). HTML ("AAAA");//the content is empty P$ ("P:has (i)");//P label with I label$ ("p:parent");//if P itself is a parent, or if there are child elements$ ("P:hidden"). CSS ("Display", "block");//find the hidden p tag, <p style= "Diplay:none" >line3</p>$ ("p:visible"). CSS ("display", "none");//find the visible p tagv. Attribute selector and child element selector $ ("P[class]");//include attribute class$ ("p[class=p2]");//= equals! = does not equal ^= with what header $= with what end *= contains what$ ("P[CLASS!=P2"));$("p[class][class^=a][class$=2]");//multi-layer filtering$("P:nth-child (2)");//P itself is a second child element$ ("P:first-child");//P itself is the first child element: Last-child:only-childvi. form selector $ ("Form:text");//<input type= "text" >$ ("Input:text");//you can do it.$ ("Input:file");//

jquery Selector Detailed

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.