- home ›
- methods ›
- mobile number
- Dom
- click
- inArray
- merge objects
- query string
- smartcheck
- attr
- addClass
- hasClass
- removeClass
- append
- prepend
- remove
- has
- findAll
- empty
- position
- offset
- outerWidth
- outerHeight
- replaceWith
- html
- text
- val
- parseHTML
- parseJSON
- parent
- next
- prev
- first
- last
- now
- toArray
- size
- Manipulation
- dates compare
- getMonthName
- getDayName
- .NET JSON date
- hashtag
- number Format
- pad
- smallCase
- upperCase
- Forms
- focus
- mobile number
- repetition
- placeholder
- Browser
- browser feature
- Browser Information
- Effects
- hide
- show
- sticky
- scrolline
- goUp
- Animation
- circles
- Google analytics
- Google fonts
.mobilenumber()
Description: Validate most South African mobile numbers.
Example:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>mobilenumber demo</title>
<script src="http://code.bitsycode.com/bitsycode-latest.min.js"></script>
</head>
<body>
<div class="row">
<b>Mobile Number:</b><input type="text" name="mobile_number" class="mobile_number" value="" />
<span class="result"></span>
<br /><br />
<input type="button" name="submit" id="validate" value="Validate" onclick="validate()" />
</div>
<script>
function validate(){
var response="";
var valid = bitsyCode.mobilenumber(bitsyCode(".mobile_number").val());
response = !valid ? "<strong class='error'> ✘ <b>Invalid</b></strong>" :
"<strong class='success'> ✔ <b>Valid</b></strong>";
bitsyCode(".result").html(response);
}
</script>
</body>
</html>
Preview:
Mobile Number:
Share