javascript - JS Solution for Input type=time like Chrome -


i looking javascript solution recreates <input type="time" /> behaviour on browsers, google chrome browser automatically.

basically, need these fields:

<input type="time" /> <input time="text" class="timefield" /> 

to behave equally in chrome. (i dont need buttons)

does know javascript covers already? hoped there open source solution (or similar), wasn't able find @ all.


this did recreate google chrome time field far:

i found useful plugin covers basics: https://igorescobar.github.io/jquery-mask-plugin/ selects input on focus, accepts numbers , auto-formats them time. far it:

 $('.timefield').attr('pattern', '^([01][0-9]|2[0-3]):([0-5][0-9])$');   $('.timefield').mask("20:50", {     placeholder: "--:--",      selectonfocus: true,      translation: {       2: {pattern: /[0-2]/},       5: {pattern: /[0-5]/}     }   }); 

i'm still missing important detail:

  • entering hours starts right left
  • any hour bigger 2 let focus jump minute place
  • seperate text selection of hours , minutes on focus

and have no idea on how implement of these functions. know how have start?

i suggest using bootstrap datepicker it's easy include in project, easy use , can modify timepicker. used following links accomplish :

http://bootstrap-datepicker.readthedocs.io/en/latest/

https://eonasdan.github.io/bootstrap-datetimepicker/


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -