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?
只需向这些输入字段添加readonly
属性,这将阻止直接输入
在输入上设置“只读”值。
<input type='text' id='foo' readonly='readonly'>
<input type="text" readonly/>
应该这样做。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.