How to prepend a JS event handler in Prototype? <p>I would like to add an event listener/handler to be prepended before an existing event handler in Prototype. Here is the example:</p> <pre><code>&lt;form ... onsubmit="alert('foo')" id="f1"&gt; $('f1').observe("submit", function() { alert('do this before foo'); }); &lt;/form&gt; </code></pre>