Reputation: 7074
Consider a following code:
$(document.body).click(function(e) {
console.log(e.clientX);
});
This event is supposed to fire when ever I make a click. But I have a search bar in my application. When ever I type something in the search bar and press enter it is calling the click event. Is that a bug in jQuery or I am missing any JS concept.
To replicate this issue, go to www.ebay.in then open firebug in FF then run the above script in console.
Any clarification would be really helpful.
Upvotes: 0
Views: 81
Reputation: 324620
Pressing Enter inside an input field simulates a click on the first submittable button on the form. This is standard and desired behaviour, but when blindly accepting click
events it may produce an otherwise unexpected click.
Upvotes: 5