Disable input, allow text field click

I am creating a .net web application using Bootstrap style. I have a textbox script provided with a datepicker where I would like to avoid validating the correct date string. I think I can just check for empty string values ​​(no input) as the only validation needed and disable keyboard input. So the only entry is through the datepicker.

My only problem is that applying the attribute is disabled on the datepicker field disables clicking and the datepicker is displayed with a mouse click for the textbox.

So my question is this: how can I disable input for a textbox while still allowing click?

+3


source to share


1 answer


disabled

You can use the attribute instead readonly

.

While disabled items do not respond to events (such as clicking or hovering), readonly items behave like regular items, although they are not editable. Disabled items are also not submitted when submitting forms.



JSFiddle

+6


source







All Articles