1
我有jQuery代碼中的下列代碼,在列表中向上或向下按鈕上下移動列表項目。無法在jQuery中向上或向下移動列表中的多個項目
$("#btn-move-up").click(function() {
$item = $(".highlight");
$before = $item.prev();
$item.insertBefore($before);
});
//onclick of move down button, move the item down in the list
$("#btn-move-down").click(function() {
$item = $(".highlight");
$after = $item.next();
$item.insertAfter($after);
});
代碼工作的罰款單項目,但如果您選擇多個項目,它開始表現unexpectedly.the working fiddle here。 有人可以指出我的代碼或其他更好的解決方案中的錯誤嗎?
Thanku @Fabricator它的工作。 –