jQuery Validation plugin: How to force a certain phone number format ###-###-####

后端 未结 4 1609
后悔当初
后悔当初 2021-02-10 10:34

I have jQuery Validation plugin on a page. When someone types the phone number into the form field, I want the validator to only recognize a certain format:

###-         


        
4条回答
  •  粉色の甜心
    2021-02-10 11:06

    Check out the jQuery Masked Input Plugin. It allows you to mask the input with something like this:

    $("#phone_number").mask("999-999-9999");
    

提交回复
热议问题