簡體   English   中英

如何應用我的代碼以將Ctrl + A用於全選?

[英]How to apply my code for use Ctrl+A for select All?

如何應用我的代碼以將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'> 

在此處從事件中刪除“ keyup”觸發器:

$(".allownumericwithdecimal").on("keypress keyup blur",function (event) {

像這樣離開

$(".allownumericwithdecimal").on("keypress blur",function (event) {

刪除此行

 event.preventDefault(); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM