Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试获取当前项目的索引,<p>但我什么都没有。我只得到第一个元素的索引 http://jsfiddle.net/T4uVG/7/
<p>
元素的索引<p>应与:
$(this).parent().index();
因为this是指子<span>元素。
this
<span>
演示:http: //jsfiddle.net/T4uVG/8/