Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQuery在Firefox和IE上运行不好_Javascript_Jquery_Html_Firefox - Fatal编程技术网

Javascript jQuery在Firefox和IE上运行不好

Javascript jQuery在Firefox和IE上运行不好,javascript,jquery,html,firefox,Javascript,Jquery,Html,Firefox,我创建了一个网页,JavaScript代码在Chrome上运行得非常好。但当我在Firefox和IE上测试时,它有很多bug。我只是不明白为什么我的DOM元素在我尝试用jQuery更改它们的html或文本时没有受到影响 <!DOCTYPE html> <html> <head> <title>Game</title> <link rel="stylesheet" href="https:/

我创建了一个网页,JavaScript代码在Chrome上运行得非常好。但当我在Firefox和IE上测试时,它有很多bug。我只是不明白为什么我的DOM元素在我尝试用jQuery更改它们的html或文本时没有受到影响

<!DOCTYPE html>

<html>
    <head>
        <title>Game</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    </head>
    <body>
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-2 col-md-offset-2">
                    <h2>Game</h2>
                </div>
                <div class="col-md-2">
                    <h2>Score: <span id="count">0</span></h2>
                </div>
            </div>
            <div class="row">
                <div id="tablediv" class="col-md-12">
                    <table id="table" style="empty-cells:show;table-layout:fixed;"></table>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <h2 id="message"></h2>
                </div>
            </div>
        </div>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
        <script src="script.js"></script>
    </body>
</html>

这只是我尝试在#count元素文本中添加1的代码部分。它在铬上工作良好。但它不会在Firefox或IE上添加1。这很奇怪。

它有很多bug
-分享它们。。。我认为你需要用jquery的几乎随处可见的
文档就绪
模式来包装你的代码。你需要提供一个?FF和IE中发生了什么?控制台中是否有任何错误,或者…?是的,请提供所有代码。如果可能,创建一个JSFIDLE或codepen并发布链接。
if($('#' + i + j).html() == x) {

            $('#count').text(parseInt($('#count').text()) + 1);

            if(parseInt($('#count').text()) == 20) {

                clearInterval(interval);
                $('#message').text("You won!");

            }

        }