When building JavaScript widgets, they should communicate with "outside" code similar to how native elements, especially form elements work. For example:
Default Event: window.location = el.href Prevent Default : $(el).click(function(ev){ev.preventDefault()})