Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
</head>
<body>
  <input type='text' class="txtbox" name='payment_rate' size='8' maxlength="10">&nbsp;<span class="amt_err"></span>
</body>
</html>
 
 $('input[name="payment_rate"]').keyup(function(){
    var data = $(this).val();
   // var regx = /[^0-9]+/g;
   // var regx = /^[-+]?[0-9]{1,4}(\.[0-9]{1,3})?/; 
     var regexTest = /^\d{0,2}(\.\d{1,3})?$/;
   
    console.log( data + ' patt:'+ data.match(regx));
    if ( data === '' || data.match(regx) ){
        $('.amt_err').fadeOut('slow');
    }
    else {
      $('.txtbox')
            .val('');
        $('.amt_err')
            .text('only Numeric Digits(0 to 9) allowed!')
         
            .css({'color':'#fff', 'background':'#990000', 'padding':'3px'})
            .fadeIn('fast');
    }
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers