Reputation: 19742
I am using the jQuery datepick plugin on two input boxes, and would like to prevent users of my Web site from manually entering dates in those input boxes. How could I do that?
I think I could cancel the onkeydown
and onkeypress
events, but it doesn't strike me as particularly elegant to do the same thing on two event handlers. Is there any other means to achieve the same thing?
Upvotes: 0
Views: 1856
Reputation: 5474
Set the "readonly" value on the input.
<input type='text' id='foo' readonly='readonly'>
Upvotes: 3
Reputation: 10598
just add readonly
attributes to those input fields, that will prevent direct entry
Upvotes: 5