I want to restict decimal and alphabatic values in textbox. I just want to enter only numbers in textbox. And do not copy and paste th text and decimal value also. Want t enter only numbers(0 o 9). How can I do this using regex of javascript o jquery.
See this fiddle, here everything is working. But arrow keys are not working. I can't able to move left and right, and if I give (shift+home) or (shift + end) its not selecting the value. Please help me for
$(".allownumericwithoutdecimal").on("keypress keyup blur",function (event) {
$(this).val($(this).val().replace(/[^\d].+/, ""));
if ((event.which < 48 || event.which > 57)) {
event.preventDefault();
}
});
<span>Int</span>
<input type="text" name="numeric" class='allownumericwithoutdecimal'>
<div>Numeric values only allowed (Without Decimal Point) </div>
do this.