Parsley.js - Validate optional input for only numbers

后端 未结 1 2061
既然无缘
既然无缘 2021-02-20 03:30

I have a form that has one optional input and 3 required input fields. For the optional input I have the below markup:



        
1条回答
  •  暖寄归人
    2021-02-20 04:23

    You can use data-parsley-type="digits". Notice the use of type="text" instead of number.

    This works if you only want to allow digits (not floats).

    
    

    If you want floats, you can use data-parsley-type='number':

    
    

    0 讨论(0)
提交回复
热议问题