I write this code for checking:
var num = $("#knum").val();
if (isNaN(parseInt(num))) {
$("#errorknum").html("Please define a number.");
}
else {
if (num < 1 | num > 249) {
$("#errorkrnum").html("your number must be less then 249 and can be greater than 1");
}
else {
$("#errorknum").html("");
}
Everything is fine but, for example, when the user type 1242fdlfldsf
means it is 1242 but she accept it. How can I dishandle this value by code like for example: 23232dkfj