I need to check if the user typed a string in a field where they can only receive an Integer, I made the sequential code and when I click the button, it always returns the alert regardless of whether I write an integer or a string, what's wrong?
$("button.nextButton").unbind("click").click(function(e){
e.preventDefault();
var endereco = $("#denuncias_end").val();
if(typeof endereco == 'number')
{
return true;
}
else
{
alert("Por favor, numero de endereco somente em numeros.");
return false;
}
});