我试图收集一个扇区中的ID列表(数组)
<div id="mydiv">
<span id='span1'>
<span id='span2'>
</div>
$("#mydiv").find("span");
Run Code Online (Sandbox Code Playgroud)
给了我一个jQuery对象,但不是一个真正的数组;
我可以
var array = jQuery.makeArray($("#mydiv").find("span"));
Run Code Online (Sandbox Code Playgroud)
然后使用for循环将id属性放入另一个数组中
或者我能做到
$("#mydiv").find("span").each(function(){}); //but i cannot really get the id and assign it to an array that is not with in the scope?(or can I)
Run Code Online (Sandbox Code Playgroud)
无论如何,我只是想知道jQuery中是否有简写这样做;