[英]Script becomes unresponsive crashing firefox
Why does this script cause an error on submit in firefox? 为什么此脚本在firefox中导致提交错误? It is using jquery.
它正在使用jquery。
$(document).ready(function(e) {
$('#errorMessage').hide();
$('#form').submit(function() {
var firstname = $('#formFirstname').val();
if(firstname == '') {
$('#errorMessage').html('Please enter your Name.');
$('#errorMessage').fadeIn();
}
else {
$('#errorMessage').html('Please wait a moment as the form Submits.');
$('#form').submit();
}
return false;
})
});
$('#form').submit();
导致递归?
You are aliasing the jQuery to e
. 您正在将jQuery别名为
e
。
Change $(document).ready(function(e) {
to $(document).ready(function() {
将
$(document).ready(function(e) {
更改$(document).ready(function() {
Or jQuery(document).ready(function($) {
或
jQuery(document).ready(function($) {
Edit: 编辑:
Although it may not cause the error, in your code e
is also jQuery
's alias, e('#form')
will also work. 尽管它可能不会导致错误,但是在您的代码中
e
也是jQuery
的别名, e('#form')
也可以使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.