JavaScript警报在Firefox中正常工作,但在Chrome和Explorer中不正常

JavaScript alert works normally Firefox, but not in Chrome and Explorer

本文关键字:但在 Chrome 不正常 Explorer 工作 Firefox JavaScript 常工作      更新时间:2023-09-26

我有简单的jquery代码和页面上的"显示警报"按钮

当我点击"显示警报"按钮时;页面的所有设计都失真了。它可以正常运行Firefox,但不能在Chrome和Explorer中运行。

请参阅问题链接:http://bit.ly/1vnHPU2

$(function() {
      $("#buttonAlert").click( function()
           {
             alert('button clicked');
           }
      );
});

编辑:

i清除了页面上脚本块的所有点击功能。但问题并没有解决

谢谢!

我在添加标签按钮类型时遇到了问题

   <button  class="btn btn-primary btn-block"  id="buttonAlert" name="buttonAlert"  >  Show Alert  </button>

   <button type="button" class="btn btn-primary btn-block"  id="buttonAlert" name="buttonAlert"  >  Show Alert  </button>

感谢所有对这个问题感兴趣的朋友。

$(function() {
      $("#buttonAlert").on("click", function()
           {
             alert('button clicked');
           }
      );
});

试试看,有时我会遇到".click()"的问题

相关文章: