简体   繁体   English

脚本变得无响应崩溃的Firefox

[英]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.

相关问题 Firefox javascript变得无法响应警告 - Firefox javascript becomes unresponsive warning Selenium - 无响应的脚本错误(Firefox) - Selenium - Unresponsive Script Error (Firefox) 一台计算机上的Firefox上反复出现“无响应脚本警告” - Recurrent “Unresponsive Script Warning” on Firefox on one machine 我将项目推送到数组中,但脚本无响应? - I am pushing items into an array but the script becomes unresponsive? 使用Addon SDK API下载许多文件时,Firefox UI变得无响应 - Firefox UI becomes unresponsive while downloading many files with Addon SDK API Web 浏览器(Chromium/Firefox)在文件对话框后 1-2 秒无响应 - Web Browser (Chromium/Firefox) becomes unresponsive for 1-2sec after file dialog 如何避免使用长时间运行的Javascript在Firefox中的无响应脚本弹出窗口? - How to avoid the Unresponsive Script popup in Firefox with long running Javascript? 如何在服务器端修复Firefox无响应脚本警告? - How to fix Firefox unresponsive script warning on server side? Webdriver / FXDriver utils.js在Firefox中导致“无响应脚本”错误 - Webdriver/FXDriver utils.js causing 'unresponsive script' error in Firefox 动态 contenteditable 脚本在 Firefox 上崩溃(但在 Chrome 上运行) - Dynamic contenteditable script crashing on Firefox (but running on Chrome)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM