[JQuery Note]Selector 1

Code
effect
example
#+id
select the specific controller whose id is that
$(#mytable)

element

select all the element whose name is that
$(input)
element1 element2
Matches all element with tag element2 that are descendants of element1
$(ul.myList,li)
element1,element2
select all the element whose name is in those value
$(div,span)
element[A]
Matches all element with attribute A
$(input[ID])
.name
select the element whose  class is that name
$(ul.myLisst)
> (Child Selectors)
select the direct child
example1
^,$,*(Attribute Selectors)
select the element whose attribute is that
example2
 
examole1:
<ul class="myList">

  <li><a href="http://jquery.com">jQuery supports</a>

    <ul>

      <li><a href="css1">CSS1</a></li>

      <li><a href="css2">CSS2</a></li>

      <li><a href="css3">CSS3</a></li>

      <li>Basic XPath</li>

    </ul>

  </li>

  <li>jQuery also supports

    <ul>

      <li>Custom selectors</li>

      <li>Form selectors</li>

    </ul>

  </li>

</ul>

 ${ul.myList > li >ul > li >a } means : 

     select the <a href="css1">CSS1</a>, <a href="css2">CSS2</a>,<a href="css3">CSS3</a>
${ul.myList > li >a } means:
     select the <a href="http://jquery.com">jQuery supports</a>;
 
example2:
<div>

    <label>Radio group:</label>

    <input type="radio" name="radioGroup" id="radioA" value="A"/> A

    <input type="radio" name="radioGroup" id="radioB" value="B" checked="checked"/> B

    <input type="radio" name="radioGroup" id="radioC" value="C"/> C

  </div>

  <div>

    <label>Checkboxes:</label>

    <input type="checkbox" name="checkboxes" id="checkbox1" value="1"/> 1

    <input type="checkbox" name="checkboxes" id="checkbox2" value="2"/> 2

    <input type="checkbox" name="checkboxes" id="checkbox3" value="3" checked="checked"/> 3

    <input type="checkbox" name="checkboxes" id="checkbox4" value="4"/> 4

  </div>

  <button type="submit" id="submitButton">Submit</button>

 ${input[type='checkbox']} means:

     select the checkbox input.
${input[type='radio']} means:
     select the radio
${input[type^='ra']} means:
     select the input elements which type's value begin with 'ra';
${input[type$='ox']} means:
     select the input elements which type's value end with 'ox';(Regex)
${input[type*='ck']} means
     select the input elements which type's value contain the string 'ck'

你可能感兴趣的:(selector)