This line
iattn=$('#ATTN').val();
Returns a string.
If you want to see whether it can be converted to an integer, then what you want is this:
iattn=parseInt($('#ATTN').val());
if (iattn) {
alert("oh");
}
Use parseFloat
rather than parseInt
if you want a more general number test.
If you want to check that the result of parsing matches the input, use something like this:
iattn=$('#ATTN').val();
if (iattn == parseInt(iattn)) {
alert("oh");
}
A simpler check, which won't actually convert anything to a number, and will allow all number formats (eg 2.3, 0x3, +23) is this:
if (!isNaN(iattn)) {
alert("oh");
}
Credit to @p.s.w.g from a comment.