<ul>
<li id="RadListBox1_i2" class="rlbItem ui-draggable">
<div class="ui-draggable ui-state-default" data-shortid="1007">
<em>ProductId: </em>
<span>110-01-070-10</span>
<br>
<em>ShortID: </em>
<span class="ShortID" data-shortid="1007">1007</span>
<br>
<em>Product Name: </em>
<span>Clearly Retro Style Colour Name Necklace</span>
<br>
<em>
</div>
</span>
</li>
<li id="RadListBox1_i3" class="rlbItem ui-draggable">
<li id="RadListBox1_i4" class="rlbItem ui-draggable">
</ul>
我需要构建选择器来查找包含 id=X 的元素并通过.draggable('disable');
有人这样想:
在哪里找到 y 类data-shortid=X
并制作它
$("ul li").find(".ShortID").attr("data-shortid="+X+).draggable('disable');
回答 :
$("span.ShortID[data-shortid="+ShortId+"]").parents("li:first").draggable("disable");