我有从文本中删除符号的功能。如何在文本字段中保留逗号和点(.,)?因为目前函数删除所有不是数字的人
$('.numbersOnly').bind("keyup paste", function(){
setTimeout(jQuery.proxy(function() {
this.val(this.val().replace(/[^0-9]/g, ''));
}, $(this)), 0);
});
最佳答案
试试这个
this.val(this.val().replace(/[^0-9,.]/g, ''));
关于javascript - 使用 jquery 从文本字段中删除符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25076260/