slj90 Posted January 6, 2015 Share Posted January 6, 2015 Each status has a comment textarea. How can I get it to alert what the user has typed in the textarea when the return key is pressed. The textarea in the PHP loop is like this: <textarea class='commentbox' id='" . $thisid . "'></textarea> The reason why I am asking this and not how to save it to the database etc is because I think I will be able to do that. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/293710-alert-textarea-text-when-pressing-return-key/ Share on other sites More sharing options...
CroNiX Posted January 6, 2015 Share Posted January 6, 2015 Are you sure you need to do this? What's the goal here? Default form behavior is to submit the form when enter is pressed. Altering that behavior could lead to a bad user experience since most are used to the default behavior for forms. The only way to do what you are asking is to use javascript. Are you using a library such as jQuery? Depending on what you're using, the answer would look different. Quote Link to comment https://forums.phpfreaks.com/topic/293710-alert-textarea-text-when-pressing-return-key/#findComment-1501927 Share on other sites More sharing options...
requinix Posted January 6, 2015 Share Posted January 6, 2015 Also, textareas are supposed to be for long text inputs. Are you sure you want to deny letting people add newlines? Would a one-line textbox be more appropriate? Quote Link to comment https://forums.phpfreaks.com/topic/293710-alert-textarea-text-when-pressing-return-key/#findComment-1501930 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.