0
こんにちはIamはJquery 1.6.2とJqueryUI 1.8.16を使用しています。 私はJqueryUIでソート可能なリストを持っています。リスト項目から現在のli項目を削除するボタンがあります。また、ダイアログボックスを使用して、ulリストにli項目を追加します。すべて私のプロジェクトは、最初の作業には、並べ替えのオプションも正常に動作しているものは、添付された項目で動作しない削除ボタンが動作しない新しいliの項目を追加した後initisialisationでうまく動作します。 は、ここに私のコードJquery UIソート可能なリストの更新
$.noConflict();
jQuery(document).ready(function($) {
//the sortbale list init
$("#sortable").sortable({
placeholder: "ui-state-highlight"
});
//when a remove button with class .remo is clicked remove the parent li
$(".remo").click(function() {
$(this).parent().remove();
});
//and the dialog to add more li items
$("#dialog").dialog({
autoOpen: false,
height: 500,
width: 550,
modal: true,
show: "blind",
hide: "explode",
buttons: {
Add: function() {
if($("#mark").val()!="" && $("#series").val()!=""){
var addme = "<li >a new li item <div class='remo'>x</div></li>";
$("#sortable").append(addme);
$(this).dialog("close");
}
},
Cancel: function() {
$(this).dialog("close");
}
}
});
});//end of dom ready
そして、私のhtmlコード
<div id="dialog" title="Manage ul ">
<b>Click add for a new one</b><br>
</div>
<!--and the sortable list-->
<ul id="sortable" style="list-style-type: none;margin: 0;padding: 0;">
<li>Li 1 <div class="remo" >x</div></li>
<li >Li 2 <button class="remo">x</button> </li>
<li >Li 3 <button class="remo" >x</button> </li>
</ul>
任意の提案ですか?
素晴らしいです!どうもありがとう! – Theodore