如何申请使用我的代码Ctrl+A
全选?如何申请使用我的代码Ctrl + A选择全部?
http://jsfiddle.net/Fp4sJ/806/
首先,填充数EG: 333.44
到输入,然后按键Ctrl + A键。
为什么不选择输入中的所有数据,我该如何申请?
<script type="text/javascript" src="//code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(window).load(function(){
$(".allownumericwithdecimal").on("keypress keyup blur",function (event) {
//this.value = this.value.replace(/[^0-9\.]/g,'');
$(this).val($(this).val().replace(/[^0-9\.]/g,''));
if ((event.which != 46 || $(this).val().indexOf('.') != -1) && (event.which < 48 || event.which > 57)) {
event.preventDefault();
}
});
});
</script>
<input type="text" name="numeric" class='allownumericwithdecimal'>
它的作品,如果你拿出那个JavaScript,或只是使用按键。使用一个输入类型=数字,而不是离边JS。 – dandavis 2014-12-03 05:43:25