Jump to content

Recommended Posts

why doesn't the jquery click() work in IE? Well, not all versions of IE, there were some versions it worked, now I have the newest version (9.0.7930.16406), and older some of the older versions do not work either.

 

this is how I do it:

$(document).ready(function(){
$("#login").click(function(){
//code to execute here
});
});

Link to comment
https://forums.phpfreaks.com/topic/226142-jquery-click-doesnt-work-in-ie/
Share on other sites

The code I just posted above is a completely separate piece of code, it has nothing to do with the login. I used that for a clean simple test to check whether or not it was a piece of my code, or just the jquery click() that wasn't working in IE. I posted the version of IE that I am using that it does not work in, I know I had this issue on older versions of IE as well, on older computers at school, but it worked fine on my computer which had IE 8.

The only thing I can think of is that 'body' is part of the page but it's not ALL of the page, so you can't necessary click anywhere in your window and see the popup.  Or else, it may or may not happen depending on what browser (version) you use.  I mean for instance, with nothing else except for that snippet of code, I personally don't expect to be able to see that alert when clicking anywhere in the browser, because you don't actually have any html or body tag or anything.  Even if the browser auto-generates those tags for you...why should the body tag span the entire window when you have nothing in it?  I know it's an example, but for instance:

$(document).ready(function(){
  $(document).click(function(){
    alert('a');
  });
});

 

That works for me, even in IE8.  Point being that even without any html or anything, everywhere in the browser window is somehow part of the document.

Oh, I know that, the page I tested it on had a good amount of body space on it, it wasn't blank, and my point was that it worked in firefox, but not in IE (when clicking inside body)

(and also, that code you just gave me works in firefox but not in IE.)

p.s. - not a fact that click() doesn't work at all in certain versions of IE.  With very few exceptions, the core jquery.js library MUST work for all major browsers and versions, otherwise it wouldn't be put into it.  I am quite sure it is some problem on your end, be it something in my previous post or else a problem in some other part of your code that you aren't showing.  I mean even here you keep saying inconsistent things.  You say that you tested with ONLY that code but then turn around and say that you are testing it somewhere that has lots of other code.  You JUST said in your previous post that it did not work in IE8..but then you are now saying it does!  And now you are claiming it doesn't work in older versions  but then can't say which ones.

 

The bottom line is that if a core jquery method being used in an extremely basic example did not work in these major browser versions as you claim, it would be a well known issue.  The reason it's not working is not because .click() doesn't work, it's because you are either not using it correctly or else you had some browser setting turned off or disabled or not pointing to the right file, etc... I'm sorry, but that's just how it is.

 

I'm not trying to fight here...I'm here to help, not fight.  But you aren't going to solve your problem unless you stop making assumptions and be more accurate in your posts.

 

 

Maybe your schools are using IE5 or something.  Schools have a tendency to use outdated stuff.  As mentioned previously, jQuery works for IE6+.  And as far as IE9...IE9 just went from preview to beta.  You cannot expect things to work 100% in a beta.  But nonetheless, so far I did some quick research and I am not seeing any reports of problems with .click() and IE9.  But if you really think there is some kind of bug with IE9 then I suggest you report it on jquery.com

alright, yeah I made an entirely new site, and I took the latest Jquery framework off of their site and tested this page with it, again worked fine in firefox, but not in IE9.

 

<!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="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="jquery.js"></script> 

</head>

<body>
<script>
$(document).ready(function(){
  $(document).click(function(){
    alert('a');
  });
});
</script>

</body>
</html>

Okay well then...

 

Maybe your schools are using IE5 or something.  Schools have a tendency to use outdated stuff.  As mentioned previously, jQuery works for IE6+.  And as far as IE9...IE9 just went from preview to beta.  You cannot expect things to work 100% in a beta.  But nonetheless, so far I did some quick research and I am not seeing any reports of problems with .click() and IE9.  But if you really think there is some kind of bug with IE9 then I suggest you report it on jquery.com

 

 

Nothing happens, in either firefox nor Internet Explorer, and it's not just the body element it doesn't work on, I was just using this as an example, What I have it for is for the button to login and sign up, as well as with other stuff.

You probably have an error somewhere in your javascript then - this can prevent all javascript on a page from working. Are you using firefox with firebug? If not, install firebug on firefox, and then open the page with the firebug window open, it will show you where the errors lie in your code.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.