if I have the following:
$('body').on('click', function() {
//alert($(this).attr('class')); alerts undefined because 'body' has no class
});
how can I get the specific element that was clicked on?
basically what I'm doing is, if anything on the body is clicked do one thing, but if its a specific element, do something else. so I'm checking the class, but that's not working
something like:
$('body').on('click', function() {
if($(this).hasClass('specific') {
//do specific();
} else {
//do generic();
}
});