0

I understand the concept of the placeholder attribute, but I am trying to more strictly guide the user. Once the user enters data in the input field with the placeholder text, it vanishes, and I would like it to persist.

I am trying to have the user input a timestamp in the form of HH:MM. But I would like my input to first appear as __:__, where when a user enters a number, it replaces the _ with that number. When they reach the :, it skips over it, and the semicolon can never be deleted. I'm not exactly sure what phrase to google this scenario for, so I thought I would ask here.

user3334871
  • 1,251
  • 2
  • 14
  • 36

2 Answers2

1

As mentioned by CBroe, the input field mask will help in your situation.

You can consider using plugins/libraries like:

They can be really helpful.

Cheers! Happy programming.

sihao
  • 431
  • 2
  • 11
1

Check out following links

Input Time masking using Jquery

More advanced way

Another one Jquery plugin

Community
  • 1
  • 1
Ameya
  • 726
  • 6
  • 9