我有一个功能,可以让我在单击时选择一个元素。它是这样的:
$('ul.grid li').click(function() {
var input = $(this).find('input.select-state:first');
var value = input.attr('value');
if (value == '0') {
$(this).addClass('active');
input.attr('value', '1');
} else {
$(this).removeClass('active');
input.attr('value', '0');
}
});
当我向其中添加 jQuery 可排序时,当我删除它时会立即选择被删除的元素,因为此函数运行。解决这个问题的方法是什么?
谢谢!