點(diǎn)擊選擇器查看獲取的元素:
$("#Lastname")
$(".intro")
$(".intro, #Lastname")
$("h1")
$("h1, p")
$("p:first")
$("p:last")
$("tr:even")
$("tr:odd")
$("p:first-child")
$("p:first-of-type")
$("p:last-child")
$("p:last-of-type")
$("li:nth-child(1)")
$("li:nth-last-child(1)")
$("li:nth-of-type(2)")
$("li:nth-last-of-type(2)")
$("b:only-child")
$("h3:only-of-type")
$("div > p")
$("div p")
$("ul + h3")
$("ul ~ table")
$("ul li:eq(0)")
$("ul li:gt(0)")
$("ul li:lt(2)")
$(":header")
$(":header:not(h1)")
$(":animated")
$(":focus")
$(":contains(Duck)")
$("div:has(p)")
$(":empty")
$(":parent")
$("p:hidden")
$("table:visible")
$(":root")
$("p:lang(it)")
$("[id]")
$("[id=my-Address]")
$("p[id!=my-Address]")
$("[id$=ess]")
$("[id|=my]")
$("[id^=L]")
$("[title~=beautiful]")
$("[id*=s]")
$(":input")
$(":text")
$(":password")
$(":radio")
$(":checkbox")
$(":submit")
$(":reset")
$(":button")
$(":image")
$(":file")
$(":enabled")
$(":disabled")
$(":selected")
$(":checked")
$("*")
輸出結(jié)果:

<h1>Welcome to My Homepage</h1>

<div class="intro">

<p>My name is Donald <span id="Lastname">Duck</span></p>

<p id="my-Address">I live in Duckburg</p>

<p>I have many friends:</p>

</div>

<ul id="Listfriends>
  • <li>Goofy</li>
  • <li>Mickey</li>
  • <li>Daisy</li>
  • <li>Pluto</li>
</ul>

<p>I really like Daisy!!</p>

<p lang="it" title="Hello beautiful">Ciao bella</p>

    <h3>We are all animals!</h3>

    <p><b>My latest discoveries has led me to believe that we are all animals:</b></p>

    <table>
      Name Type of Animal
      Mickey Mouse
      Goofey Dog
      Daisy Duck
      Pluto Dog
      </table>