jQuery validate - how do I ignore letter case?

后端 未结 5 2087
无人共我
无人共我 2021-02-20 16:08

Probably a goofy question, but I can\'t seem to find anything in google land. I simply need one of my methods to ignore the case of the entered field. I am doing a city name mat

5条回答
  •  你的背包
    2021-02-20 16:27

    The easiest way to get a case-insensitive match is to convert both values to uppercase and then compare (uppercase because in certain cultures/languages the upper- to lowercase conversion can change a character!).

    So make the check

    value.toUpperCase() == "Atlanta".toUpperCase()
    

提交回复
热议问题