allow only numeric (0-9) in html inputbox using jquery

 jsnya :  
 <script type="text/javascript">  
   $(document).ready(function(){     
 //numeric  
     numericOnly('biaya');  
     numericOnly('OutboundDetail_weight');  
     function numericOnly(id){  
       $("#"+id).keydown(function(event) {  
         // Allow: backspace, delete, tab, escape, and enter  
         if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 ||   
            // Allow: Ctrl+A  
           (event.keyCode == 65 && event.ctrlKey === true) ||   
            // Allow: home, end, left, right  
           (event.keyCode >= 35 && event.keyCode <= 39)) {  
              // let it happen, don't do anything  
              return;  
         }  
         else {  
           // Ensure that it is a number and stop the keypress  
           if (event.shiftKey || (event.keyCode < 48 || event.keyCode > 57) && (event.keyCode < 96 || event.keyCode > 105 )) {  
             event.preventDefault();   
           }    
         }  
       });  
     }  
 });  
 </script>  
 htmlnya :  
 <input type="text" id="biaya" name="biaya">  
 <input type="text" id="OutboundDetail_weight" name="OutboundDetail_weight">  

Comments

  1. How to Play Baccarat - FEBCASINO
    Baccarat involves two separate bets: a first, a straight, and a quarter bet (the first febcasino and the second part of the bet) in which you have worrione to 메리트카지노 pay out your

    ReplyDelete

Post a Comment

silahkan berkomentar, kritik dan saran yang membangun adalah harapkan kita semua !

Popular posts from this blog

Data Flow Diagram (DFD)

VERIFIKASI SUARA MENGGUNAKAN METODE MFCC DAN DTW MENGGUNAKAN METODE MFCC DAN DTW (BAB II TINJAUAN PUSTAKA)

flexigrid + php with add and edit button