I am trying to use jQuery to do something like
if(jQuery(\'#id\').click) {
//do-some-stuff
} else {
//run function2
}
But I\'m unsure h
Maybe you're looking for something like this:
$(document).click(function(e)
{
if($(e.srcElement).attr('id')=='id')
{
alert('click on #id');
}
else
{
alert('click on something else');
}
});
jsfiddle
You may retrieve a pointer to the clicked element using event.srcElement
.
So all you have to do is to check the id-attribute of the clicked element.