I have a handler attached to an event and I would like it to execute only if it is triggered by a human, and not by a trigger() method. How do I tell the difference?
For example,
$('.checkbox').change(function(e){
if (e.isHuman())
{
alert ('human');
}
});
$('.checkbox').trigger('change'); //doesn't alert
You can check
e.originalEvent: if it’s defined the click is human:Look at the fiddle http://jsfiddle.net/Uf8Wv/
my example in the fiddle: