I have a simple script with simple math function. I want user to insert only numbers. How can I do it in the code? Or even better – how can I prevent the input of non-numeric characters?
$('form').submit(
function (e) {
e.preventDefault();
$('#result').text("Result is " + parseInt($('#var1').val()) / 2 + " days");
});
you can check the input thru this:
or with jquery: