Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

validate mobile number in javascript

var val = number.value
if (/^d{10}$/.test(val)) {
    // value is ok, use it
} else {
    alert("Invalid number; must be ten digits")
    number.focus()
    return false
}
 
PREVIOUS NEXT
Tagged: #validate #mobile #number #javascript
ADD COMMENT
Topic
Name
6+7 =