How can I test the field client side with HTML5 read only?
I have an input field that launches a datepicker. To make this work on a mobile device, I made a read-only field. This means I can start the date picker on click (or touch) with jQuery, and the tap does not open the keyboard on the mobile device.
However - the attribute readonly
bypasses HTML5 validation mechanisms. Can I add something that then either mimics the look and feel of HTML5 validation in order to maintain consistency, or that forces HTML5 validation despite being a field readonly
?
Edit . I am looking for confirmation that the field is filled in (required) and it is desirable that it conforms to a specific date format.
source to share
readonly
fields cannot have an attribute required
, as a rule, they will already contain some value.
Have a look at Standard HTML5 Drafts
source to share