click - only on "direct" onclicks
You have two choices:
Attach a click
event handler to the input element and prevent the event from bubbling up by calling event.stopPropagation()
[docs]:
$('input').click(function(event) {
event.stopPropagation();
});
OR
Inspect the event.target
[docs] in the click
event handler attached to the div
whether the target is the input
element or not. Something like:
if(event.target.nodeName !== 'INPUT') {
// do something
}
you can use this:
if(event.toElement != this)
return;