jquery-datetextentry icon indicating copy to clipboard operation
jquery-datetextentry copied to clipboard

Add mobile patterns too input

Open erikandershed opened this issue 9 years ago • 4 comments

How do I add mobile numbers keyboard to the input. This will make a nicer the user experience

erikandershed avatar Feb 07 '17 08:02 erikandershed

I agree, that would be a better user experience (although some people would suggest using the native HTML5 date input on mobile would be even better - you may wish to consider that).

There is no easy way to do it with the current plugin code because of the way the placeholder text is implemented ('DD' is not a valid value for a numeric input). However changing that to use the HTML5 placeholder attribute and then setting the input type to number should do the trick. I aim to do this soon but I'm happy to look at patches if you're impatient.

grantm avatar Feb 07 '17 08:02 grantm

I was only thinking of adding pattern to the inputs that is added by the jquery-datetextentry. It would make the input for a user faster then today. But maybe the HTML5 date is the best way, but I still think this is a quick fix for adding a higher the user experience.

Where in the code can I add pattern="\d*" for the 3 input the script is adding?

erikandershed avatar Feb 07 '17 09:02 erikandershed

Just search for "<input" in jquery.datetextentry.js.

grantm avatar Feb 07 '17 09:02 grantm

Thanks! I did change the input in the jquery.datetextentry.js on line 510 to pattern="[0-9]*". It works great :)

erikandershed avatar Feb 07 '17 09:02 erikandershed