How can I prevent the user from typing in a date or anything else in the <input> element connected with a jQuery datepicker ?

Recommended Answers

All 4 Replies

Set it to readonly.

no, I mean I want the users to select the date by clicking on a particular date from the datepicker, not type in it. By readonly, u mean make it disabled ?

`

 <script type="text/javascript">

  $(function() {
    $( "#date" ).datepicker({
minDate: 0, 
maxDate: " +10D" ,
dateFormat:'yy-mm-dd'

    });
  });

  </script>
<input type="text" name="date" id="date"></td></tr>
I think this will help you just download the juery ui 

`

as pritaeas said make the field readonly datepicker will still work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.