Skip to content

Instantly share code, notes, and snippets.

@iamrealfarhanbd
Last active November 18, 2022 06:50
Show Gist options
  • Save iamrealfarhanbd/f51669d4139473249456d7f082fe0676 to your computer and use it in GitHub Desktop.
Save iamrealfarhanbd/f51669d4139473249456d7f082fe0676 to your computer and use it in GitHub Desktop.
// output = iamfarhan09@gmail.com = true;
// output = iamfarhan09@gmail = false
// output = iamfarhan09@gmail.com.co =true
//N.B: you have to replace all ids with your form id otherwise it will not work.
jQuery(document).ready(function() {
jQuery("#fluentform_36 button[type='submit']").attr('disabled', true);
jQuery('input#ff_36_email').on("change", function() {
const email = jQuery("input#ff_36_email").val();
const regex = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if(!regex.test(email)) {
jQuery("#fluentform_36 button[type='submit']").attr('disabled', true);
} else {
jQuery("#fluentform_36 button[type='submit']" ).attr('disabled', false);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment