Firefox 意外重置表单
Firefox unexpectedly resets form
在 "reset"(s) "confirm" window 上按 "cancel" 时,Firefox 正在清除表单。尝试过:
<input class="grow" type="reset" name="reset" id="res" onclick="confirm('reset?')">
还有:
$('#res').on('click',function(){
var c = confirm('Reset the data?');
if(c==true){
$( ".counter" ).text( q + " of " + n.length );
}
});
两者都在 Chrome 和 Safari 中正常工作。
您没有对 return 值执行任何操作。尝试:
<input class="grow" type="reset" name="reset" id="res" onclick="return confirm('reset?')">
jQuery 版本相同:
$('#res').on('click',function(){
var c = confirm('Reset the data?');
if(c==true){
$( ".counter" ).text( q + " of " + n.length );
}
return c;
});
在 "reset"(s) "confirm" window 上按 "cancel" 时,Firefox 正在清除表单。尝试过:
<input class="grow" type="reset" name="reset" id="res" onclick="confirm('reset?')">
还有:
$('#res').on('click',function(){
var c = confirm('Reset the data?');
if(c==true){
$( ".counter" ).text( q + " of " + n.length );
}
});
两者都在 Chrome 和 Safari 中正常工作。
您没有对 return 值执行任何操作。尝试:
<input class="grow" type="reset" name="reset" id="res" onclick="return confirm('reset?')">
jQuery 版本相同:
$('#res').on('click',function(){
var c = confirm('Reset the data?');
if(c==true){
$( ".counter" ).text( q + " of " + n.length );
}
return c;
});