Reputation: 2308
Might be simple but I can find a reasonable explanation for that
$(document).ready(function(){
$(document).click(function () {
alert('ok');
});
});
Does not fire the alert(); I am using the newest google chrome. Does browser put some restriction for that as there is in ajax callback functions?
Edit 1: Code is within $(document).ready();
Upvotes: 0
Views: 139
Reputation: 20111
Strange but true, that's working on firefox but not on chrome. Try this one, works for me for latest version of chrome and firefox too:
$(document.body).click(function () {
alert('ok');
});
Upvotes: 1
Reputation: 41832
I think you forgot to Encapsulate your code with
$(function(){
//your code here
});
or
$(document).ready(function(){
//your code here
});
Upvotes: 3