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
  • 18,755
  • 12
  • 103
  • 140
Syno
  • 1,056
  • 10
  • 25

1 Answers1

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

Hope this helps...

Amit Jamwal
  • 629
  • 1
  • 6
  • 16