<div class="row">
<div class="col-md-6 offset-md-3">
<input type="text" class="form-control"
placeholder="Full Name" name="customer_name"
id="customer_name" autocomplete="off" required>
</div>
</div>
<script>
$('#customer_name').keypress(function(e) {
var keyCode = e.keyCode || e.which;
//Regex for Valid Characters i.e.
Alphabets and Numbers.
var regex = /^[A-Za-z0-9]+$/;
//Validate TextBox value against the Regex.
var isValid = regex.test(String.fromCharCode(keyCode));
if (!isValid) {
return false;
}
return isValid;
});
</script>
No comments:
Post a Comment