jquery Basic Operations

Source: Internet
Author: User

1. Selector
1.1.id Selector

$(‘#id‘)

1.2.class Selector

$(‘.cl‘)

1.3. Tag Selector

<div></div>$(‘div‘)

1.4 Combo Selector

<div id="i1">    <div class="c1">        <a>1</a>        <a>2</a>        <a>3</a>    </div></div>$(‘#i1,.c1,a ‘)   #i1和.c1和a的所有标签

1.5. Hierarchy Selector

<div id="i1">    <div class="c1">        <a>1</a>        <a>2</a>        <a>3</a>    </div></div>$(‘#i1 .c1 a ‘)  #i1下的.c1下的所有a标签(包括子孙后代)$(‘#i1.c1>a ‘)  #i1下的.c1下的所有a标签(只有儿子代)

1.6. Basic

:first   $(‘#i1 .c1 a:first‘) #i1下的.c1下的第一个a标签:last   $(‘#i1 .c1 a:last‘) #i1下的.c1下的最后一个a标签:eq()  $(‘#i1 .c1 a:eq(1)‘) #i1下的.c1下的最后一个a标签

1.7. Properties

$(‘[name]‘)       具有name属性的所有标签$(‘[name="user"]‘) name属性等于user的标签

jquery Basic Operations

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.