我的代码如下:
当我在内容 div 的 span 元素中放置 li 项目时,我想获取 span 标签的 id 怎么可能?
<ul class="secd_line_icon" id="secd_line_icon" >
<li id="products">
<img id="productid_1" class="product" src="https://si0.twimg.com/profile_images/1888289249/heart_sm_normal.jpg" />
</li>
</ul>
<ul id="bookmark_icon" class="droppable" style="height: 100px;">
</ul>
<div id="content" >
<span id="s1">I have two hearts
Heart is pulsating with blood <span>
<span id="s2"> And heart is pulsating with love
</span>
</div>
<script>
$("#content").droppable({
accept: '#secd_line_icon li',
drop: function(event, ui) {
$("#bookmark_icon").append($(ui.draggable).clone());
$("#content_area .product").addClass("item");
$(".item").removeClass("ui-draggable product");
$(".item").draggable({
containment: 'parent',
grid: [150,150]
});
}
});
$("#secd_line_icon li").draggable({
helper: 'clone'
});
</script>