开发者

Change JavaScript NaN Message to Something Else

I've got an input[type="text"] that throws up a NaN error until another box is filled. I know why the message is appearing, that's not a problem, it's correct. I开发者_JAVA技巧'm just wondering if I can change 'NaN' to something more descriptive for the user.


if(isNaN(input.value)) {
    input2.value = '';//or a message of your choice
}


Test the value with isNaN(value) and if true then handle it however you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜