How to check the textbox value is string or integer in jquery
if ($('#TournamentFee').is(NaN)) {
alert("String");
} else {
alert("Int");
}
How to check the textbox value is string or integer in jquery
if ($('#TournamentFee').is(NaN)) {
alert("String");
} else {
alert("Int");
}
try this:
function isNumber(n) {
n = n.replace(',','.');
return !isNaN(parseFloat(n)) && isFinite(n);
}
var str = $('#TournamentFee').val();
if (!isNumber(str) {
alert("String");
} else {
alert("Int");
}
http://stackoverflow.com/questions/6466709/check-whether-a-textbox-value-is-numeric-or-string – Devendra Lattu Dec 13 '13 at 14:45