Why is my onclick event not executing?
<p>I have a simple button that executes a javascript function on click. The button seems to be refreshing the page, and the js code is not executing at all.</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;title&gt;Dynamic Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;div class="col-sm-12 blog-main"&gt;
    &lt;form class="form-addCards form-inline" role="form"&gt;
        &lt;div class="col-xs-2" id="submitBtn"&gt;
            &lt;button class="btn btn-primary" onclick="submit();"&gt;Submit&lt;/button&gt;
        &lt;/div&gt;
    &lt;/form&gt;
&lt;/div&gt;

&lt;script src="newSet.js"&gt;&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>And the js:</p>

<pre><code>function submit(){
    event.preventDefault();
    alert("hit");
}
</code></pre>