Keith
Keith

Reputation: 26499

How to append value from form field in a new form field

Here's the story.

I have a form with some form fields.

Example:

What I would like to do is when I click to submit the form, get JQuery to grab the email field value and append it to the message field.

I have the value stored here:

var email = $('#email').val();

Any ideas?

Upvotes: 0

Views: 3044

Answers (2)

knabar
knabar

Reputation: 1156

This should work:

$("#message").val( $("#message").val() + $('#email').val() );

Upvotes: 0

albertein
albertein

Reputation: 27118

$("#message").val ($("#message").val () + $('#email').val());

Upvotes: 2

Related Questions