JS Snippets
These are helpful javascript examples
Add Focus To Form Element
Will set cursor or focus to form element with id 'x'.
Add Leading Zero
Adds a leading 0 to a number
Email Validation
Returns true or false
Number Validation
Will disallow a non-numeric character into an input box. Example below:
<input type="text" id="number" name="number" maxlength="2" onkeydown="return isNumber(event);" />
Pass Array To PHP
Returns [[1,2,3,5],[],[16,15],[18,19,20,21,11],[23,24],[]]
Password Validation
Returns error string or blank
Phone Validation
Returns true or false
Random Number
Returns number between min 'x' & max 'y'.