JS Check whether the amount of input is duplicated

Source: Internet
Author: User

/** * Check if there is a duplicate of the amount entered*/functioncheckrangerepeat () {varMoneyoutarr =NewArray (); varMoneyoutmap = {}; $("Input[name= ' moneyminout ']"). each (function(index) {Moneyoutarr[index]= Parsefloat ($ ( This). Val ());    }); $("Input[name= ' moneymaxout ']"). each (function(index) {if(Moneyoutarr[index]inchMoneyoutmap) {Layer.open ({content:' Payment rules cannot be repeated! '            }); return false; } Moneyoutmap[moneyoutarr[index]]= Parsefloat ($ ( This). Val ());    }); //Release rule scope non-duplicate check    //sort from small to largeMoneyoutarr.sort (function(A, b) {returna > B? 1:-1    });  for(vari = 0; i < moneyoutarr.length-1; i++) {        varStartmoney =Moneyoutarr[i]; varEndmoney =Moneyoutmap[startmoney]; varStartmoneynext = moneyoutarr[i + 1]; varEndmoneynext =Moneyoutmap[startmoneynext]; if(Startmoney > Endmoney | | startmoneynext >Endmoneynext) {Layer.open ({content:' The minimum amount of the distribution rules must not be greater than the maximum amount of consumption! '            }); return false; }        if(Endmoney >=Startmoneynext) {Layer.open ({content:' Payment rules cannot be repeated! '            }); return false; }    }}

JS Check whether the amount of input is duplicated

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.