I have a simple question. The following code works for all the tags:
$('*').click(function(e) {
alert(1);
});
But, when I try this code for the div with id “content”:
$('#content').click(function(e) {
alert(1);
});
What am I doing wrong ?
Make sure it’s within a document ready tagAlternatively, try using
.liveExample:
As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers.