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
Post a Comment