You can remove the complex logic from clearSearch
and just have it clear the search box. Then add some new onClick handlers to the elements you don't want to call this method. In those handlers set event.cancelBubble
to true to prevent the clearSearch function being called.
From quirksmode:
For a complete cross-browser experience do: function doSomething(e) { if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); }
Mark Byers
2010-02-26 22:24:29