How to append value from form field in a new form field
Question
Here's the story.
I have a form with some form fields.
Example:
- name
- message
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?
Solution
$("#message").val ($("#message").val () + $('#email').val());
OTHER TIPS
This should work:
$("#message").val( $("#message").val() + $('#email').val() );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow