简体   繁体   中英

$(document).ready() doesn't seem to work on Internet Explorer. How can I fix this?

Our website seems to work well with Google Chrome, Mozilla Firefox and Safari but I noticed that it doesn't work properly on Internet Explorer. More specifically, it doesn't invoke the $(document).ready(function ()); on Internet Explorer for specific types of pages. I don't have access to Internet Explorer with me nor can I debug my localhost code on it but I'd highly appreciate if someone could tell me what's wrong in my code. I can't seem to find anything wrong with it (unless jquery doesn't always work in IE).

For example, check out the following link: http://www.listicle.co/list/user/post.php?listid=589

All of the code works in all other browsers except IE. Can someone with access to IE and IE debugger tools pinpoint what I can change to fix this? I'm really pulling hairs here trying to understand why this isn't working. I tried debugging on a friend's computer and all I could infer is that the document ready code is never invoked.

Any help would be highly appreciated.

Thanks.

It can fail in IE if there any error in the page. Check out the developer console in IE and fix all the errors.

For example, I once had an error

SCRIPT438: Object doesn't support property or method 'autocomplete'

on the page and then none of the code in

$(document).ready(function ())

was executed.

When I fixed the error, it started working.

jQuery document ready works with IE, however IE does have some poor support for JavaScript, so there could be other issues which prevented the code from running correctly in IE.

One place for instance, where I sometimes forgotten is array/object literal in IE must not end with a comma. Other browsers would happily accept the extra comma, but IE will throw (silent) syntax error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM