HTML5 pattern for formatting input box to take date mm/dd/yyyy?

Easiest way is use read only attribute to prevent direct user input: <input class=”datepicker” type=”text” name=”date” value=”” readonly /> Or you could use HTML5 validation based on pattern attribute. Date input pattern (dd/mm/yyyy or mm/dd/yyyy): <input type=”text” pattern=”\d{1,2}/\d{1,2}/\d{4}” class=”datepicker” name=”date” value=”” />

HTML Input cursor position issue in Chrome when value is empty

Cause: Looks like this is a regression bug in the Chromium 38 engine. I can reproduce in Chrome 38.* and Opera 25.* (which uses Chromium 38). Reported Bug/s: As pointed out by @JackieChiles it appears to be a regression of this [closed as obselete] bug: https://code.google.com/p/chromium/issues/detail?id=47284 As suggested in the closed bug, I have logged … Read more

Failed to execute ‘setSelectionRange’ on ‘HTMLInputElement’: The input element’s type (‘number’) does not support selection

I know this is an old question, but I did find a good workaround without using the tel input type. By changing the input type from number to text before the selection, the error goes away and you get to keep all the benefits of the number input type. tel allows text input, which may … Read more

Thymeleaf – How to add checked attribute to input conditionally

According to the official thymeleaf documentation http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#fixed-value-boolean-attributes th:checked is considered as a fixed-value Boolean attribute. <input type=”checkbox” name=”active” th:checked=”${user.active}” /> Where user.active should be a boolean. So in your case it should be as Andrea mentioned, <input type=”checkbox” name=”mycheckbox” th:checked=”${flag}” />

When to use the required attribute vs the aria-required attribute for input elements?

When John Foliot wrote that article in 2012 it was very much true. You needed both. Today that is no longer the case. I can take your example, put it in a CodePen, and check it in JAWS and NVDA (sorry, no VoiceOver today): <label for=”textbox1″>Input</label> <input id=”textbox1″ type=”text” name=”Text Box” required> You will be … Read more