javascript - Alert message when there is duplicate email -


i need show alert message when there duplicate email address.

here code:

$.validator.addmethod("contactpersonen-email", function(value, element) {     var parentform = $(element).closest('form');     var timerepeated = 0;     if (value != '') {         $(parentform.find(':text')).each(function () {             if ($(this).val() === value) {                 timerepeated++;             }         });     }     return timerepeated === 1 || timerepeated === 0;     alert('duplicate'); }, "email adres bestaat al"); 

but doesn't work. find out problem , make working?

$.validator.addmethod("contactpersonen-email", function(value, element) {     var parentform = $(element).closest('form');     var timerepeated = 0;     if (value != '') {         $(parentform.find(':text')).each(function () {             if ($(this).val() === value) {                 timerepeated++;             }         });     }     var ok = timerepeated === 1 || timerepeated === 0;     if(!ok) alert('duplicate');     return ok; }, "email adres bestaat al"); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -