4
I need to check if the user typed a string in a field where he can only receive an Integer, did the code sequinte and when I click on the button, he always returns the Alert regardless of whether I write an integer or a string, which is 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;
}
});
Tip: Make an Alert after the first one that shows
typeof endereco
.– mutlei