Prevent onclick from firing
<p>I was working around with form submissions in html. Please take a look at below code</p>

<pre><code>&lt;form id="form1"&gt;
 &lt;button id="btn1" onclick="clicked();"&gt;Submit&lt;/button&gt;
&lt;/form&gt;
&lt;script&gt;
    $("#btn1").click(function (event) {
        alert("event triggered");
        if(some_condition == true){
             // stop firing onclick method but it always submits the form
             event.stopImmediatePropogation(); // not working
             event.preventDefault(); // not working
             event.stopPropogation(); // not working it's for bubbled events
         }
     });
     function clicked(){ alert("clicked me"); }
&lt;/script&gt;
</code></pre>

<p>I want to stop <code>clicked()</code> function from firing which is attached to inline <code>onclick</code> attribute. I would like to run my jquery click function and if something goes wrong, I dont want to trigger onclick but it always runs clicked() function.  Could any one help me. Any help is greatly appreciated. </p>