Lorem ipsum dolor sit amet, consectetuer adipiscing elit aenean comm odo ligula eget dolor massa Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean egestas magna at porttitor vehicula nullam.
© Copyright 2018 Projectkhushi var $ = jQuery.noConflict(); $(document).ready(function() { var messages = { 'required' : 'This field is required', 'min_2_char' : 'Please enter alteast 2 characters', 'min_20_char' : 'Please enter alteast 20 characters', 'valid_pnumber' : 'Please enter valid phone number', 'valid_email' : 'Please enter a valid email' } $('input#fname').on('keydown keyup', function() { var _this = $(this); var _thisVal = _this.val(); var wpcf7nvt = $(this).closest('label').find('.error_message'); var validated = _thisVal.replace(/[^a-zA-Z .]/g,''); validated = validated.replace(/\s\s+/g,' '); _this.val(validated); if(_thisVal == '') { wpcf7nvt.html(messages.required); } else if(validated.length < 2) { wpcf7nvt.html(messages.min_2_char); } else { wpcf7nvt.html(''); } }); $('input#pnumber').on('keydown keyup', function() { var wpcf7nvt = $(this).closest('label').find('.error_message'); var _this = $(this).val(); var validated = _this.replace(/[^0-9+]/g,''); validated = validated.replace(/\+\+/g,'+'); $('input#pnumber').val(validated); if(_this == '') { wpcf7nvt.html(messages.required); } else if(validated.length < 4) { wpcf7nvt.html(messages.valid_pnumber); } else { wpcf7nvt.html(''); } }); $('input#email').on('keydown keyup', function() { var emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var wpcf7nvt = $(this).closest('label').find('.error_message'); var _this = $(this).val(); var validated = _this.replace(/[^a-zA-Z0-9.@_-]/g,''); $('input#email').val(validated); if(validated == '') { wpcf7nvt.html(messages.required); } else if (emailReg.test(validated) == false) { wpcf7nvt.html(messages.valid_email); } else { wpcf7nvt.html(''); } }); $('#message-box').on('keydown keyup submit', function() { var _this = $(this); var _thisVal = _this.val(); var validated = _thisVal.replace(/\s\s+/g,' '); _this.val(validated); var wpcf7nvt = $(this).closest('label').find('.error_message'); if(validated == '') { wpcf7nvt.html(messages.required); } else if(validated.length < 20) { wpcf7nvt.html(messages.min_20_char); } else { wpcf7nvt.html(''); } }); $('.wpcf7-submit').on('click', function() { $('#fname, #pnumber, #email, #message-box').trigger('keyup'); setTimeout(function() { $('.wpcf7-response-output').fadeOut('slow'); },5000); }); });