你好,我有非常相似,這選擇div的IDS有speciffic類
<div id="bigBadDiv">
<div class="head">
blabla
</div>
<div class="contents">
<div class="1">
<div id="432" class="item "></div>
<div id="45" class="item selected"></div>
<div id="86" class="item "></div>
<div id="3" class="item "></div>
</div>
<div class="2">
<div id="443" class="item"></div>
<div id="867" class="item selected"></div>
<div id="43" class="item selected"></div>
<div id="98" class="item selected"></div>
</div>
<div class="3">
<div id="423" class="item selected"></div>
<div id="167" class="item "></div>
<div id="4453" class="item "></div>
<div id="944" class="item "></div>
</div>
</div>
<div class="footer">
blabla
</div>
我想選擇的ID唯一的.selected物品的東西,我嘗試用
使它$('#bigBadDiv :has(.selected)').css({'backgroundColor':'red'});
但它將.contents背景變爲紅色...
你知道爲什麼會這樣嗎?
你能幫我選擇每個div.selected並採取它的ID值?也許有某種循環..?
在此先感謝!