Show Alert Message When Input Is Too Short using jQuery
<p>I am trying to display an alert message when the input is shorter than given limit, using jQuery. Unfortunately, my code isn't working, therefore, seeking your help.  </p>

<p>Here are the codes I am using.</p>

<p>HTML</p>

<pre><code>&lt;input type="textarea" name="message" id="message" row="20" col="50" /&gt;
&lt;input type="submit" name="submit" id="submit" value="Send Message" /&gt;
</code></pre>

<p>JavaScript</p>

<pre><code>&lt;script type="text/javascript"&gt;
    jQuery(document).ready(function($) {
        $("input:submit[name='submit']").on("click",function() {
        var msgwords = $("input:textarea[name='message']").val().replace( /[^\w ]/g, "" ).split( /\s+/ ).length;
        var minwords = 10;
            if (comwords &lt; minwords) {
                alert("Your Comment is too short.");
            }
        });
    });
&lt;/script&gt;
</code></pre>
