so i got this little code and i can't get it working and i simply can't see why. I've copied the code from another code i wrote and only removed and renamed all the stuff that i don't need. I want to give out the value of a variable in an alert box.
The JS:
<script>
function ready2() {
var rdy = $("#rdy").value;
alert(rdy);
}
</script>
The HTML:
<body> <form id="form2" onsubmit="return false;"> <div>Ready:</div> <input type="text" id="rdy"></input> <button id="btn" onclick="ready2()">Ready</button> </form> </body>
If I replace $("#rdy").value; with something like "hello world", it works. So the problem must be the variable or better: the input box. The alert box always says "undefined" and I don't know why.
Any help?