Check the value of the field in HH:MM format
<p>I have a field which should take input in format HH:MM (it can be <code>00:01</code>, <code>01:19</code>, <code>25:00</code>, <code>99:34</code>, <code>123:12</code>) </p>

<p>So before submitting the form I need to check whether the value is in any of the above formats else throw an error message .</p>

<p>The field:</p>

<pre><code>&lt;input type="text" value="" name="totalDuration" id="total_duration" class="" /&gt;
</code></pre>

<p>Validation code goes here</p>

<pre><code>function validate(){
    var totalDuration = $("#total_duration").val();

    // Rest of the code which checks value is in given format
} 
</code></pre>
