0 Users appreciate this thread.
The hell am i doing wrong
ryanb000977 (2014-08-05 03:09:38)It's executing the code as soon as you load the page. Make it like the one below:
Source Code
<script> function showTxt() { var txt = document.getElementById("txt" ).value; alert(txt); } </script> <textarea id="txt"></textarea><br> <a href="#" onclick="showTxt()">Submit</a>
<script> function showTxt() { var txt = document.getElementById("txt" ).value; alert(txt); } </script> <textarea id="txt"></textarea><br> <a href="#" onclick="showTxt()">Submit</a>
2014-08-05 10:13:04
carlos11 (2014-08-05 09:46:36)Simple. You forgot to add mayonnaise.
Language is a tool for efficient communication. The internet is a tool for fast communication. Do not defy both intents by posting incoherent writing.
PLMasterSSB (2014-08-05 13:33:05)thx @ryanb000977. I forgot you had to put it in a function to execute. I haven't coded in a long time so I forgot that.
^ Click
(This Image was created from cooltext.com)
Log in to submit a comment
Back to forum: Web Programming (HTML, JS, CSS, PHP, MySQL)
New registered users today: 7
Newest registered user: ElegantVulpes
<textarea id="cap_text"></textarea>
<script>
var cap_text = document.getElementById("cap_text"
alert(cap_text);
</script>
the alert window is empty even when I inputed text. i've done this before with other scripts and it worked. The hell am I doing wrong.
^ Click
(This Image was created from cooltext.com)