私のスクリプトでは、要素 (リスト) をある親 (テキストのみ) から別の親 (リスト) に移動してから、再び (リストに) 移動しようとしています。問題は、要素を元の親 (ul) に戻すと、クリックできなくなることです。remove() よりも detach() を使用するとうまくいくかもしれないと思いましたが、違いはありません。
$(document).ready(function() {
$("#inventoryWeapon li").click(function(event) {
var clickedId = event.target.id;
if ($("td#weapon").is(":empty")) {
$("td#weapon").text(clickedId);
$(this).detach();
}
});
$("td#weapon").click(function(event) {
var unequipping = $(this).text();
$("#inventoryWeapon").append("<li id='" + unequipping + "'>" + unequipping + "</li>");
$(this).detach();
});
});