make an input only-numeric type on knockout

后端 未结 10 1077
情书的邮戳
情书的邮戳 2020-11-30 06:15

i read many tutorials but i dont know how to do this, this is the input

input(type=\"text\",name=\"price\",id=\"price\"data-bind=\"text: price,valueUpdate:[\         


        
10条回答
  •  难免孤独
    2020-11-30 06:38

     
    

    create AlphaCheck Function and add that.

        $('#alpha-validation').keyup(function () {
            if (this.value.match(/[^0-9 ]/g)) {
                this.value = this.value.replace(/[^0-9 ]/g, '');
            }
        });
    

    That will works!

提交回复
热议问题