HTML File
<div class="lbl">Mobile No : </div>
<div class="ctrl">
<input type="number" name="con">
<span id ="err_cn"></span>
</div>
Java Script File
function con_validation(con)
{
var numbers = /^([0-9]{10})$/;
if (con.value.match(numbers))
{
document.getElementById("err_cn").innerHTML = "";
return true;
}
else
{
var msg = "please enter valid Contact No. ...";
document.getElementById("err_cn").innerHTML = msg;
con.focus();
return false;
}
}
No comments:
Post a Comment