Textbox accept only numbers using jQuery
Textbox accept only numeric values with input tag of HTML using JQuery Code
Numeric Values Accept: <input id="digits" type="text" />
<script>
$('#digits').keydown(function(){
<script>
$('#digits').keydown(function(){
//allow backspace, tab, ctrl+A, escape, carriage return
if (event.keyCode == 8 || event.keyCode == 9
|| Add to dictionary == 27 || event.keyCode == 13
|| (event.keyCode == 65 && event.ctrlKey === true) )
return;
if((event.keyCode < 48 || event.keyCode > 57))
event.preventDefault();
});
</script>
if (event.keyCode == 8 || event.keyCode == 9
|| Add to dictionary == 27 || event.keyCode == 13
|| (event.keyCode == 65 && event.ctrlKey === true) )
return;
if((event.keyCode < 48 || event.keyCode > 57))
event.preventDefault();
});
</script>
0 Comments