Reputation: 10485
Ok, my last post was a failure, so let's try this again.
If you visit www.davekiss.com and click on the icon in the top right corner, you'll see a customized implementation of a jQuery slider. Click on the "Contact" button and fill out the textarea.
Basically, what I am trying to is save the value in that textarea to a javascript variable, but for some reason, that variable is undefined.
The code in question:
jQuery("a#send-thoughts").click(function() {
var thought = jQuery("textarea#message").val();
alert(thought);
/*jQuery.ajax({
type: "POST",
url: "process.php",
data: "message=" + message,
success: function(msg){
alert( "Data Saved: " + msg );
}
});*/
});
Any ideas?
Upvotes: 0
Views: 2526
Reputation: 32345
You also have a syntax parse error on line 232. You're missing a )
to your append function.
Upvotes: 0
Reputation: 7953
Your textarea has a name of 'message', but not an id. Your selector is selecting based on an ID, but no such element exists. Either give the textarea the id of "message", or change your selector to find by name (former is probably preferred).
Upvotes: 4
Reputation: 298176
Try getting it's .text()
:
var thought = jQuery("textarea#message").text();
Upvotes: 0