1

I have a select element in part of my page, and a form all the way on the bottom. I'm trying to populate one of the form variables with the value of the select element like this:

<input type="hidden" value="valuefromselectelement..." name="foo" id="foo"/>

How can I do that? Presume the select element has the id currencySelect.

2 Answers 2

1

you should handle the form's onsubmit event

and put $('#foo').val($('#currencySelect').val());

Sign up to request clarification or add additional context in comments.

Comments

0
$("#foo").val($("#currencySelect").val());

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.