[問題] Select first depth children
如下,假設有一個list下面還有一個list:
<ul>
<li>
<ul>
<li></li>
<li></li>
</ul>
<li>
<li></li>
<li></li>
</ul>
How can I use jQuery selector or HTML DOM to access the first depth <li> tags without those in the
sublist?
比方說我如果打$("ul li").method();則每個li都會執行這個method。
除了把第一層的li歸類到同一個class外(ex.改成<li class="firstDepth">),
有沒有其他更好的方法?
謝謝囉~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.240.236.106
推
04/19 20:14, , 1F
04/19 20:14, 1F
→
04/19 20:20, , 2F
04/19 20:20, 2F
→
04/19 20:21, , 3F
04/19 20:21, 3F
→
04/19 20:24, , 4F
04/19 20:24, 4F
推
04/19 20:25, , 5F
04/19 20:25, 5F
→
04/19 20:26, , 6F
04/19 20:26, 6F
→
04/19 20:27, , 7F
04/19 20:27, 7F
→
04/19 20:35, , 8F
04/19 20:35, 8F
→
04/19 20:35, , 9F
04/19 20:35, 9F
→
04/19 20:36, , 10F
04/19 20:36, 10F
→
04/19 20:36, , 11F
04/19 20:36, 11F
→
04/19 20:36, , 12F
04/19 20:36, 12F
→
04/19 20:37, , 13F
04/19 20:37, 13F
→
04/19 20:37, , 14F
04/19 20:37, 14F
→
04/19 20:38, , 15F
04/19 20:38, 15F
→
04/19 20:38, , 16F
04/19 20:38, 16F
→
04/19 20:56, , 17F
04/19 20:56, 17F
→
04/19 20:57, , 18F
04/19 20:57, 18F
→
04/20 10:16, , 19F
04/20 10:16, 19F
→
04/20 11:40, , 20F
04/20 11:40, 20F
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章