How can I get preventDefault to work for all browsers? <p>I have weird problem with event.preventDefault. This works fine on Chrome but doesn't work on Firefox. I know many people fix it by adding event arg like this: myFunction(event) but doing this makes it stop working on both Chrome and Firefox. Can someone help me get this code working on all browsers?</p> <pre><code> &lt;script type="text/javascript"&gt; function myFunction() { var asdf = $('input[name=payment_type]:checked', '#buy').val() if (asdf == 'theRightOne') { event.preventDefault() alert("stuff") } } &lt;/script&gt; </code></pre>