Alicia Posted February 3, 2010 Share Posted February 3, 2010 Hi, I wanted to replace the textfield in the script below to textarea but then the javascript function will stop working. How can I make the textarea works as the textfield when the enter key is pressed ? Please advise. or is there any way i can increase the lines of the textfield? <script> function handleEnter(e) { var characterCode; if(e && e.which) { e = e; characterCode = e.which; } else { e = event; characterCode = e.keyCode; } if(characterCode == 13) { document.forms["myform"].submit(); return false; } else { return true; } } </script> <form id="myform" action="submit-form.php" method="get"> <p>Search: <input type='textarea' name='query'> </p> <p> <label> <input type="submit" name="button" id="button" value="Submit"> </label> </p> </form> Link to comment https://forums.phpfreaks.com/topic/190773-enter-key-to-submit-form-in-textarea/ Share on other sites More sharing options...
Alicia Posted February 3, 2010 Author Share Posted February 3, 2010 anyone? Link to comment https://forums.phpfreaks.com/topic/190773-enter-key-to-submit-form-in-textarea/#findComment-1006133 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.