I have a form with a name field and a text area.
When the user types in their name I want to include it in the text area along with some other pre-formatted text.
How can this be done?
jQuery?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a
keyuphandler on the text input and add areadonly="readonly"attribute to the textarea if you want to use it for display only.For example:
And some jQuery:
Live demo: http://jsfiddle.net/ambiguous/Tt2gt/1/
Binding to the
keyupevent will get your<textarea>updating callback called every time a key is pressed in the<input>(including backspaces). If you use achangehandler, the<textarea>won’t be updated until the<input>loses focus and that doesn’t sound like what you’re after.