 <p>The events in a DOM start somewhere in your tree going down to the element (capturing phase) and then they bubble up the DOM (bubbling phase).</p> <p>You can catch the event and stop it from propagating. It wont be propageted further then and wont call other event handlers (like your second function) which are attached to e.g. wrapping elements.</p> <p>In the event handler of the autocomplete you should call <code>stopPropagation()</code> on the event. Altough this doesnt work in all browsers. In IE prior to IE9 the method is called <code>cancelBubble(true)</code>.</p> <p>In order to prevent a browsers default behaviour you can do <code>event.preventDefault()</code></p> <p>You can read more on this by searching "Event Cancellation" or "Event Propagation", as this is a tricky topic in JavaScript</p>