jquery - Required field that should be filled only with integers -


i working upon validation of field in field should filled integers , validation field needed given?

i inserted script tags follows:

<script type="text/javascript" src="jquery.numeric.js"></script> <script> jquery(document).ready(function(){ $("#estvalue").numeric({ negative: false  },  function() { alert("no negative values"); this.value = ""; this.focus(); }); });   </script> <input name="est_value" id="estvalue" class="regi_input_1" style="width: 150px; height: 25px;" type="text" /> 

use html5

<input type="number" min="0" />   <input name="est_value" id="estvalue" class="regi_input_1" style="width: 150px; height: 25px;" type="number" min="0" /> 

validation using javascript

<input name="est_value" id="estvalue" class="regi_input_1" style="width: 150px; height: 25px;" type="text" onkeypress="if ( isnan( string.fromcharcode(event.keycode) )){ alert('numbers only'); return false; }" /> 

working demo http://jsfiddle.net/cse_tushar/fevrb/


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -