我正在使用插件从列表中滑动删除行:
$('#swipeMe li').swipeDelete();
$('#swipeMe li').on('click', function(){
$(this).trigger('swiperight')
});
当我用 html 编写 swipeDelete 功能时,它可以正常工作:
<h2>Assets </h2>
<div id="Assets">
<ul id="swipeMe">
<li ><a href="#">This doesn't works</a></li>
<li data-swipeurl="#"><a href="#">This works<</a></li>
<li data-swipeurl="#"><a href="#">This works<</a></li>
<li data-swipeurl="#"><a href="#">This works<</a></li>
<li data-swipeurl="#"><a href="#">This works<</a></li>
<li data-swipeurl="#"><a href="#">This works<</a></li>
<li data-swipeurl="#"><a href="#">This works<</a></li>
<li >This doesn't</li>
</ul>
</div>
但它不在我附加的新列表项上:
$('.submitAsset').click(function(){
var asset = $('#asset_number').val();
$('<li data-swipeurl="#"><a href="#">' + asset + '</a></li>')
.appendTo('#Assets #swipeMe').swipeDelete();
$('#assetForm').slideUp();
});
请帮忙 :/