Adding a zero before a single digit date in javascript
<p>I am validating date field using javascript and there i need to validate the DD/MM/YY</p>

<p>if the user enter the date as 10/06/2012 it will be valid</p>

<p>if the user enter the date as  3/06/2012 means we need to add a zero before the date as 03/06/2012.</p>

<p>my javascript code is </p>

<pre><code>$('#date').blur(function () {
            var collector = $('#date').val();
            collector = collector.split("/");
            if (collector[0].length != 2) {
                if (collector[0].length == 1) {
                    //here code for make it as two digit
                }
            }
            else
            {
             alert('Date is not entered properly');
            }
});
</code></pre>

<p>my html</p>

<pre><code>Date: &lt;input type="text" id="date" name="date" /&gt;
</code></pre>

<p>How to do it with javascript </p>
