我在我的html中有这个
<input type="checkbox" id="1234">
<input type="checkbox" id="2345">
<input type="checkbox" id="3456">
<input type="checkbox" id="4567">
<input type="checkbox" id="5678">
我想要获取 id 列表中所有元素的内容。
我尝试使用 $(":checkbox").attr('id', items_id);
和 var items_cb = $(":checkbox[id='items_id']");
,其中 items_id 是 id 列表,但是它们并没有起到作用。
同时,id 列表的格式为 1234 2345 3456
或者 #1234 #2345 #3456