MasterGberry
MasterGberry

Reputation: 2860

Having issues with jquery on internet explorer

I am having issues getting some jquery to work on internet explorer...sometimes it seems to work, and sometimes it doesn't seem to work. Having no issues with chrome/firefox though, i don't understand what can be the cause of these issues.

I am not including the jquery source from the file, but rather putting the file inline the file. I have split it up into a few lines like they do in the actual jquery.min.js though, so that shouldn't be causing any issues.

The rest of the HTML is all on one line though, could the length of this line be causing issues? When clicking some of the links on the page and the listners should activate on the click() function it just opens up the windows explorer tool instead of catching it and having e.preventDefault() activating.

I could show you guys the source for the JS, but I know that is working properly, as I said its fine on chrome/firefox, so I feel there is some hidden issue I don't know about for internet explorer. I have listed all of the possible details and causes of this issue....help please? Thanks to any information and I can answer any questions to get this working :)

EDIT:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-type" content="application/octet-stream" /><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><!-- JQUERY 1.7.2 HERE --></head><body><!-- HTML IS HERE WITH LOTS OF DIVS --><!-- JQUERY CODE HERE --></body></html>

Upvotes: 0

Views: 1259

Answers (2)

user1791022
user1791022

Reputation: 41

Had the same issues with javascript, that was running perfectly under Chrome and Firefox and seemed to totally not load on IE, and I was amazed to find out that Internet explorer is not executing your javascript if you have console.log in your code, used for debugging (or other purposes), and thanks to stackoverflow I understood about this.

So if everything in IE seems to work fine with Dev. tools open (F12) then after removing console.log from your scripts everything will be ok.

Upvotes: 4

Sablefoste
Sablefoste

Reputation: 4192

If you have any console.log statements, take them out. If developer tools are enabled (F12), IE will work. Otherwise, it will stop executing code with console.log.

The best way to test this is open the developer tools, and then see if the code works in IE. If it does, then removing the statements should fix the problem.

Upvotes: 1

Related Questions