+ 1

what to if I want to check whether input was a number or not by javascript only.

I tried to write a code for it please mention the error. https://code.sololearn.com/WvXXEoU924jw/?ref=app

8th Oct 2017, 6:37 AM
DeCoded
DeCoded - avatar
4 Réponses
+ 1
You can use if (isNaN(x.value)) But for number only input, you should set your input as number use <input type="number" >
8th Oct 2017, 6:45 AM
Calviղ
Calviղ - avatar
+ 1
Thanks @Calvin
8th Oct 2017, 6:50 AM
DeCoded
DeCoded - avatar
8th Oct 2017, 7:29 AM
Calviղ
Calviղ - avatar
0
But I want in which part of javascript we learn about NaN type things?
8th Oct 2017, 6:51 AM
DeCoded
DeCoded - avatar