Many forms will have a field for contact number. Contact
number can be given as a single input box
What if we wanted to separate the contact number input box
into two or more fields?
For getting mobile number as input, we can have 3 boxes. First
box and second box accepting three numbers and third box accepting 4 numbers.
To implement this, we have to create 3 input elements,
In order to get only 3 numbers in first two inputs and 4 numbers in last input, we can use the
maxlength property
Don’t forget to give space after maxlength = 3 and input
closing tag.
Thus we have three input boxes which accepts 3,3, 4 inputs
respectively.
Let us make the boxes little cooler!!! Imagine the cursor
moving automatically to the next input box when maximum length is reached !!!
This can be achieved via Javascript.
Thank you!!
Comments
Post a Comment