JQuery script to validate number on entering by handling change event on input field - Javascript jQuery

Javascript examples for jQuery:Form Number Field

Description

JQuery script to validate number on entering by handling change event on input field

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){// w w w.  j  av a  2 s  .c o m
$('.target').change(function () {
    if($(this).val() > 10) {
       console.log('Greater than 10.');
    }
});
    });

      </script> 
 </head> 
 <body> 
  <input class="target" type="text">  
 </body>
</html>

Related Tutorials