Jump to content

Alert textarea text when pressing return key


slj90

Recommended Posts

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,

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.