1 function num (event,obj) { 2 $(document).on(event,obj,function(event){ 3 event.stopPropagation(); 4 var _this = $(this); 5 var reg = /^\d+(\.\d+)?$/; 6 var num = parseFloat( _this.val() ); 7 var result = reg.test(num); 8 if(!result){ 9 _this.val(‘‘); 10 } 11 }) 12 } 13 14 num(‘blur‘ , ‘#is2‘);
时间: 2024-10-12 05:58:59