RAILS EMAIL VALIDATION ===>
# email = email.split(" ").join('')
email = "rajpurohitnitin7@gmail.com"email = email.delete(' ')
if !/\A[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]+\z/.match(email).nil?
p "valid email address"
end
JAVASCRIPT EMAIL VALIDATION ===>
var email = "rajpurohitnitin7@gmail.com"
var re = /\S+@\S+\.\S+/var valid = re.test(email_address)if (!valid) {
console.log("valid email addresss");
}
Tokenfield Email validation ====>
$(".token_filed_class").on('tokenfield:edittoken', function (e) { }).on('tokenfield:createdtoken', function (e) { var re = /\S+@\S+\.\S+/ var valid = re.test(e.attrs.value) if (!valid) { $(e.relatedTarget).empty().hide().attr('data-value', ''); //$(".share_with_emails").on('tokenfield:removedtoken', function (e) {}) //$(e.relatedTarget).addClass('invalid') } }).on('tokenfield:removedtoken', function (e) { }), showAutocompleteOnFocus: false, createTokensOnBlur:true});
No comments:
Post a Comment