开发者

Firefox doesn't fire $(document).ready(function() {

I have a page that uses the jquery function:

$(documen开发者_StackOverflow中文版t).ready(function() {

and I have put an alert in there, and tried everything. It does not fire in firefox. But it works fine in IE and Chrome.

I have checked everything in firebug, and it's just not firing.

Here is the page it isn't working on: http://www.halotracker.com/UserVideos.aspx

On this page, the FS is deep within the site, but, I have tried putting it at the very top inside the head. Neither way works.

Thanks in advance for your time.


<script type="text/jscript">

is probably not going to fire in Firefox: JScript is Internet Explorer's interpretation of JavaScript. Use

<script type="text/javascript">

Other than that, it looks like it should work fine (even though it would be really better and cleaner to have this stuff in the head part.)


If one jQuery(document).ready block has an error inside it, later document.ready blocks do not get performed.

For example, if one wordpress plugin does error out inside its own jQuery(document).ready, then all following jQuery blocks in other plugins may start failing.

Firefox 18, Chrome 23, Opera 12 behaves this way. jQuery v1.7.2

Recently it caused some trouble to me, and I can't imagine why I never had to deal with this before.

Possibly it is a jQuery bug/unintended behaviour.


I had a similar problem and in my case, invoking an old jQuery Address .js file was the problem. For some reason, Edge, Chrome, and Opera were able to ignore maybe that old version of jQuery Address while keeping jQuery/JavaScript to work normally. But Mozilla Firefox did not behave in the same way, and jQuery/JavaScript was not working at all in Mozilla Firefox. In my case the solution was simply to comment out jQuery Address for now and I will need to upgrade it later on. I was surprised that Mozilla Firefox was rigid about it and all other browsers were flexible to allow the jQuery/JavaScript code to continue to work.


Btw, you can write it even shorter:

$(function() {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜