title: To allow the user to insert date in dd/mm/yyyy format in text-box
body: <p>Friends ,I have a text box for date to be inserted by the user but i want it to allow user to insert only "dd" ,"mm" and "yyyy" values ,slashes(/)should be already present and as soon as the user inserts "dd" values the pointer should move directly behind the slash for "mm" value and on pressing backspace it should delete the "mm" or "dd "values not the slashes(/).
  Here is what i have tried but it does not give me the desired result-</p>
  
  <pre><code>function dateCheck(){
  
     var d_value=$("#pdate").val();
     if(d_value.length =="2" || d_value.length =="5")
     {
  
      $('#pdate').val($('#pdate').val()+"/");
     }
  
  }
  </code></pre>
  
  <p>html code-</p>
  
  <pre><code>Date:&lt;input type="text" name="p_date" id="pdate"  onkeydown="dateCheck()"  placeholder="DD/MM/YYYY" required /&gt;
  </code></pre>