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

ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -

c++ - nodejs socket.io closes connection before upgrading to websocket -

python - PyQt: Label not showing correct number of length -