support 447 Posted January 21, 2022 Report Share Posted January 21, 2022 // Add Custom Email Validation jQuery.validator.addMethod('customemail', function (emailaddr, element) { emailaddr = emailaddr.replace(/\s+/g, ''); return this.optional(element) || emailaddr.match(/(^$|^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([а-яА-Яa-zA-Z\-0-9]+\.)+[а-яА-Яa-zA-Z]{2,}))$)/); }); $("#<?php echo $form_id; ?>").validate({ onsubmit: false, rules: { email_address: { required: true, minlength: <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>, customemail: true, //email: true }, }, messages: { email_address: "Введите корректный E-mail", }, onfocusout: function(element) { $(element).valid(); }, }); Link to post Share on other sites
Recommended Posts