我想要的方法来防止恢复他在做什么,如果条件不成立的代码。jQuery:如果通过别的死
这是我的代码
function doSomething{
if(1==2){
alert("Can I access to your event?");
}else{
//1 not equals 2, so please die
// I tried die() event; It worked, But i get this error in the console
// Uncaught TypeError: Cannot call method 'die' of undefined
}
}
$(".foo").click(function(){
doSomething();
alert("welcome, 1 == 1 is true");
}
JavaScript并没有一个死'()'默认功能。 –
您是指[this](http://api.jquery.com/die/)? – PSL
是的,这就是我的意思 –