Alert message when input is greater or lower than 16 digits
<p>I have created this:</p>

<pre><code>&lt;form class="form-horizontal" method="post" action="profile.php"&gt;
    &lt;div class="form-group"&gt;
        &lt;label class="col-sm-2 control-label"&gt;Card Number&lt;/label&gt;
        &lt;div class="col-sm-7"&gt; 
            &lt;input type="text" id="card_no" class="form-control" name="card_number" maxlength="16" autofocus="autofocus"&gt;
        &lt;/div&gt;
        &lt;button class="btn btn-primary demo1" type="submit" id="submit" onclick="check()"&gt;SEARCH&lt;/button&gt;
&lt;/div&gt;
</code></pre>

<p>When the card's length is greater or lower than 16 an alert message must be displayed. So I tried this:</p>

<pre><code>$('#submit').onclick(function() {
    var inputlength = $('#card_no').val().length;
    if (inputlength&lt;&gt;16) {
        sweetAlert("ERROR", "Card must have 16 digits", "warning");
        return false;
    }
});  
</code></pre>

<p>But it doesn't work. I also have an alert when there is NO input and works fine! Any ideas?</p>