1.只能输入数字

<input onkeyup="value=value.replace(/[^\d]/g,'') " onbeforepaste="window.clipboardData.setData('text',window.clipboardData.getData('text').replace(/[^\d]/g,''))">
 $("#result").keyup(function(){
            this.value=this.value.replace(/[^\d]/g,'');
        });
        
        $("#result").bind("prepaste",function(){
            window.clipboardData.setData('text',window.clipboardData.getData('text').replace(/[^\d]/g,''))
        });

 

相关文章:

  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2022-01-30
  • 2022-02-04
  • 2021-09-22
相关资源
相似解决方案