jQuery不适用于Firefox [英] jQuery is not working in Firefox

查看:187
本文介绍了jQuery不适用于Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jQuery不适用于Firefox。它在IE和Google chrome中工作正常,但是当我尝试在Mozilla Firefox中运行我的应用程序时,jQuery不起作用。任何猜测?
这是我的一段代码

 <!DOCTYPE HTML PUBLIC> 
< html>
< head>
< script type =text / javascriptsrc =http://code.jquery.com/jquery-1.7.1.js>< / script>
< script type =text / javascriptsrc =http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js>< / script>
< style>
div {
width:200px;
height:100px;
border:1px纯红色;
}
< / style>
< / head>
< body>
< div>一个< / DIV>
< div>两个< / div>
< div>三< / div>
< / body>
< script>
$('div')。click(function(){
alert(Hello .....);
});
< / script>
< / html>


解决方案

您应该使用dom ready事件



$ $ $ $ $ $ $ $ $'$ $ $''$($ div $) $ b alert(你好.....);
});
});


jQuery is not working in Firefox. It works fine in IE and Google chrome, but when I am trying to run my application in Mozilla Firefox jQuery is not working. Any guesses? Here is my piece of code

<!DOCTYPE HTML PUBLIC>
<html>
   <head>
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
      <style>
         div{
         width:200px;
         height:100px;
         border:1px solid red;
         }
      </style>
   </head>
   <body>
      <div> One</div>
      <div>Two</div>
      <div>Three</div>
   </body>
   <script>
      $('div').click(function(){
       alert("Hello.....");
      });
   </script>
</html>

解决方案

you should use the dom ready event

$(document).ready(function(){
  $('div').click(function(){
   alert("Hello.....");
  });
});

这篇关于jQuery不适用于Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆