javascript - call a script with the current value of a <textarea> when the user pushes submit? -


i'm making html document simple form on it, when user presses submit want call function takes value of textarea field , magic on it, i've had search on w3schools , done google digging can't find anything!

update: want them able enter information on , on again, i'm taking enter, changing formatting, adding things .etc , writing page, want clear textarea fresh again.

<html> <head> <script type="text/javascript">     function magic(){         var textarea =document.forms[0].elements['mytext'];         textarea.style.color = 'red';         alert(textarea.value)     } </script> </head>  <body>     <form>         <textarea name="mytext"></textarea><br/>         <input type="button" onclick="magic()" value="go"/>     </form> </body> </html> 

hi, bit of code should give idea of how can grab value of input element , manipulate using js. hope helpful :)


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -