John
John

Reputation: 3115

Click events and Google Chrome and Windows 8

I am trying to use the following JQuery code:

$("#thing").on("click", function() {
....})

And it doesn't work on Google Chrome in Windows 8, but it works in Firefox on Windows 8 and basically every other OS. Any ideas?

Upvotes: 0

Views: 383

Answers (3)

robertp
robertp

Reputation: 3672

Your code snippet looks completely fine. I assume you are using a fairly up to date version of jQuery, so most probably it is nothing to do with jQuery or the browser. I suspect there might be something wrong with the code surrounding your snippet.

As a possible solution: In Chrome you can bring up the Console, which will tell you if there is any errors in your JavaScript (developers.google.com/chrome-developer-tools/docs/…). Open it up, refresh your page (you might see the error in the Console straight away). Or click that '#thing' and watch out for any possible errors coming up in the Console.

Upvotes: 0

Alessandro Gabrielli
Alessandro Gabrielli

Reputation: 892

It works, check this: http://jsbin.com/ofuvuh/1 Probably there is some error in the code that ff ignore or maybe it's your browsers fault. Please check the chrome and ie console, probably it can helps

Upvotes: 1

Petr R.
Petr R.

Reputation: 1237

Try:

$("#thing").click(function ()
{
    // your code here
});

Which is the same as .on('click', handler). See .click documentation.

Upvotes: 0

Related Questions