Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Space Allowed Only
- function ValidateAlpha(evt)
- {
- var keyCode = (evt.which) ? evt.which : evt.keyCode
- if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 122) && keyCode != 32)
- return false;
- return true;
- }
- // "&& keyCode != 32" Remove this to Space not Allowed.
- //call function : onkeypress="return ValidateAlpha(event);"
- //Numeric Value allow only
- function isNumberKey(evt){
- var charCode = (evt.which) ? evt.which : evt.keyCode
- if (charCode != 46 && charCode > 31
- && (charCode < 48 || charCode > 57))
- return false;
- return true;
- }
- //call function : onkeypress="return isNumberKey(event)"
- //Mobile Validation
- $('.NumOnly').on('input', function (event) {
- this.value = this.value.replace(/[^0-9]/g, '');
- });
- $('.NumDotOnly').on('input', function (event) {
- this.value = this.value.replace(/[^0-9.]/g, '');
- });
- $(".AlphaDotOnly").on("input", function (event) {
- this.value = this.value.replace(/[^a-zA-Z .]/g, '');
- });
- $(".AlphaOnly").on("input", function (event) {
- this.value = this.value.replace(/[^a-zA-Z]/g, '');
- });
- function numberMobile(e){
- e.target.value = e.target.value.replace(/[^\d]/g,'');
- return false;
- }
- function AlphaOnly(e){
- e.target.value = e.target.value.replace(/[^a-zA-Z]/g, '');
- return false;
- }
- $(".modal").on("hidden.bs.modal", function(){
- $('#frm_newsletter')[0].reset(); //input control reset
- $("#frm_newsletter").validate().resetForm(); // validation error reset
- });
Add Comment
Please, Sign In to add comment