需要setTimeout()
方法的帮助。
我在这里有以下代码:
我需要能够删除newState变量的实例。认为我做错了。请协助。提前致谢。
var deleteState = setTimeout("alert('Object has been removed')" , 2000);
newState.mousedown(function(e) {
if (deleteState == 0) {
clearTimeout(deleteState);
}
jsPlumb.detachAllConnections($(this));
$(this).remove();
e.stopPropagation();
});
答案 0 :(得分:-1)
试试这个:
var deleteState = setTimeout(function(){alert('Object has been removed') } , 2000);