jquery only allow input float number

前端 未结 13 1728
既然无缘
既然无缘 2020-12-01 06:28

i\'m making some input mask that allows only float number. But current problem is I can\'t check if multiple dots entered. Can you check those dots and prevent it for me?

13条回答
  •  无人及你
    2020-12-01 07:25

    One-more plugin, based on Carlos Castillo answer

    https://github.com/nikita-vanyasin/jquery.numberfield.js

    Adds method to jQuery object:

    $('input.my_number_field').numberField(options);
    

    where options is (you can pass any or no options):

    {
        ints: 2, // digits count to the left from separator
        floats: 6, // digits count to the right from separator
        separator: "."
    }
    

提交回复
热议问题