How to get the content of textarea using jquery?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Darrel
Forum Commoner
Posts: 33
Joined: Fri Oct 10, 2014 2:30 am

How to get the content of textarea using jquery?

Post by Darrel »

I wrote the code below in a click event but it doesn't display the text I typed in the textarea element.

Code: Select all

var message = $("#Message").html();
alert(message);

Code: Select all

<textarea cols="40" rows="10" id="Message" name="Message"></textarea>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: How to get the content of textarea using jquery?

Post by Celauran »

Darrel
Forum Commoner
Posts: 33
Joined: Fri Oct 10, 2014 2:30 am

Re: How to get the content of textarea using jquery?

Post by Darrel »

Celauran wrote:$('#Message').val()
Thanks for help.
Post Reply