Textbox time validations (javascript)
Posted
by
unos
on Stack Overflow
See other posts from Stack Overflow
or by unos
Published on 2011-02-09T07:22:06Z
Indexed on
2011/02/09
7:25 UTC
Read the original article
Hit count: 112
JavaScript
I have a textbox in which user can enter time (eg- 01:00) and also a drop down box for entering AM/PM fields. (Since the AM/PM field is used, 12-hour time format is used.)
The text box allows a max entry of 5 chars only (eg - 01:00).
Pls let me know how I can set the 3rd char as a default -colon : , so that the user simply has to enter only the time.
How to check if the time entered by the user is numeric or not?.
Autocompletion feature : for eg, if user enters 1 then it would automatically be set to 01:00
Javascript Validations for 12-hour format. Eg: if user enters 13:00 then it should change to 01:00
How can I append the text box time values with the am/pm value selected in the drop down box?.
Once the values are appended, automatically populate another text box (text box 2) with the result. Eg: 01:00 + pm should be set as 01:00p in the new text box (text box 2).
Any help would be appreciated.
© Stack Overflow or respective owner