0

I know this question might have been asked a lot of times but I don't really get the function isNan(). I have a calculator and if the result is "NaN" (for example 0 divided by 0), I want to alert 'Doesn't work!'. I thought of something like:

function Error() {
    if ($('#result').val() == NaN) {
        alert.('Doesn't work!');
    }
};

The result is in the input with the #result. How do i use isNan() here? Can someone help me please? Thanks for responding and sorry for the same question again.

Sibeesh Venu
  • 15,155
  • 9
  • 82
  • 116
Syno
  • 1,036
  • 8
  • 25

1 Answers1

1
function Error() {
            if(isNaN($('#result').val())){
                alert("Doesn't work!");
            }
        };

Hope this helps...

Amit Jamwal
  • 529
  • 1
  • 5
  • 16