Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input Mask

Status
Not open for further replies.

fmrock

Programmer
Sep 5, 2006
510
US
Does anyone know how to put an input mask on a text box for a time format?
 
You could use a regular expression:

Code:
function validateTime(time)
{
    //Validate time is HH:MM
    var pattern = new RegExp("^([0-1][0-9]|[2][0-3]):([0-5][0-9])$");
    if(pattern.test(time))
        {
           //time is valid
        }
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top