The InputMask widget shows the user the correct format for an input box. In addition, it prevents invalid input and gives visual cues about the data required. An example is shown as follows:
The input format is specified by a mask. A list of options are available on http://wijmo.com/wiki/index.php/InputMask. For our example, we make an input mask for U.S. phone numbers where the area codes are optional. These optional characters can be left blank:
<!DOCTYPE HTML> <html> <head> ... <script id="scriptInit" type="text/javascript"> $(document).ready(function () { $("#textbox1").wijinputmask({ mask: '(999) 000 - 0000' }); }); </script> </head> <body> <input type="text" id="textbox1" /> </body> </html>
The masking element 9
indicates an optional digit, while 0
indicates a required digit. Literals such as the dash and parenthesis are displayed as they appear in the mask. By default, invalid inputs...