0

How to take number value in JavaScript

28th Dec 2019, 7:24 AM
Nikhil Saini
Nikhil Saini - avatar
2 Réponses
+ 2
You mean after user input? Such as "prompt" command?
28th Dec 2019, 7:32 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
HTML <input type="number" id="inp1" oninput="logNum()" /> JavaScript function logNum(){ console.log( parseInt(inp1.value) ); }
28th Dec 2019, 9:09 AM
Gordon
Gordon - avatar