jQuery Validate, need to prevent free email addresses (e.g. Gmail, Hotmail)

前端 未结 3 734
抹茶落季
抹茶落季 2020-12-21 07:36

I need to add a custom validation rule (or set of rules) to prevent a whole list of email addresses from registering. This is already running server side, but we want to hav

3条回答
  •  难免孤独
    2020-12-21 08:18

    Why you don't make un array with all emails that you don't need.

    For example.

    var email = new Array('Hotmail','Gmail','Yahoo',...,'Live');
    

    how you already has all email list, make an array or an json file, xml, txt,...,etc

    Next. Make an function handdler with regular expression.

    $(function()
    
    //  $('selector').event(function(){ 
    
    function handdlerMail(email){
               for(var i = 0; i

    I think a better way of doing this with a tree structure of weights, ie if you could create a tree which contains, emails do not want.

    then you could be evaluating your emails in logarithmic time. and at the end of walking the tree weights, you could decide whether or not it in your list of aceepted.

    ie whether or not it in the tree

提交回复
热议问题