如何申請使用我的代碼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