Pattern HTML5 validation not preventing form submit when not validated
<p>I have an odd problem where my pattern on two numerical fields is not working properly (the form can be submitted even if the fields are not validated). The HTML looks like following:</p>

<pre><code>        &lt;input type="text" class="txtmin" pattern="^[+-]?\d*(\.\d+)?$" placeholder="Minimum price"&gt;

        &lt;input type="text" class="txtmax" pattern="^[+-]?\d*(\.\d+)?$" placeholder="Maximum price"&gt;
</code></pre>

<p>When I enter something into the field, if it doesn't matches the regex, the field gets marked red, but if I try to submit the form on onclick event, the validation doesn't prevents the user to change the input value and I get an exception ...</p>

<pre><code>$(".btnAnalyze").click(function () {
            // the form doesn't validates??
        });
</code></pre>

<p>I was trying something like this:</p>

<pre><code>  $('txtmin').oninvalid = function (event) {
            return;
        }
</code></pre>

<p>But this doesn't do anything? Can someone help me out?</p>

<p>Edit: Riyad this is the full code HTML and the event I'm firing:</p>

<pre><code>&lt;form&gt;
     &lt;span class="input-group-btn"&gt;
                            &lt;button class="btn btn-default btnGo" type="submit"&gt;Go!&lt;/button&gt;
                        &lt;/span&gt;

&lt;/form&gt;

  $(".btnGo").click(function () {

            if ($('.txtSearch').val() == "") {
                ShowMessage("Please enter the search term!");
                return;
            } 
            else{
                PostAndUpdate($('.txtSearch').val(), $('input[name=type]:checked').val(), $('input[name=shipping]:checked').val(), $('input[name=condition]:checked').val(), $('.txtmin').val(), $('.txtmax').val());
            }
        });
</code></pre>