offy Posted November 17, 2010 Share Posted November 17, 2010 I have some code so when I press enter, it submits the data in textarea. But when I clear text area with document.getElementById('forminput').value = ""; The cursor stats on the second line. I think this is because of this. switch(validkey) { case 13: document.getElementById('forminput').value = ""; break; } Quote Link to comment https://forums.phpfreaks.com/topic/219010-clearning-textarea-after-enter/ Share on other sites More sharing options...
offy Posted November 18, 2010 Author Share Posted November 18, 2010 I fixed the issue. I had to set the event on "onkeyup" instead of "onkeydown" Quote Link to comment https://forums.phpfreaks.com/topic/219010-clearning-textarea-after-enter/#findComment-1135850 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.