I'm quite new to JavaScript and I have a problem. I want a user to input a number into a text input box and when they click a button, an alert box appears telling the Square Root of their number. The problem is, when the box appears, the message says 'NaN'? Can somebody help?
function convert(){
var userInput = Number(document.getElementById("sqrinput"));
alert(Math.sqrt(parseFloat(userInput)));
}
Thanks!