2013-03-12 75 views
0

http://jsfiddle.net/dude_jsfiddle/CQ9qm/如何獲得使用attr

<ul> 
    <li class="jstree-leaf" kids="0" range="5-7" name="mars" public_id="mars_05" ra_depth="5"> 
    </li> 
    <li class="jstree-leaf" kids="0" range="8-10" name="pluto" public_id="pluto_8" ra_depth="5" 
    </li> 
    </ul> 

alert($(document).find("li[name='pluto','mars']").length); 

誰知道如何讓這兩個元素兩個元素?

冥王星和火星在一個找到

+1

http://api.jquery.com/multiple-selector/ – Tetaxa 2013-03-12 09:10:46

回答

3
$(document).find("li[name='pluto'],li[name='mars']").length 
0

試試這個:

alert($(document).find("li[name='pluto'],li[name='mars']").length);