开发者

Using jQuery to pull values from a select element

开发者 https://www.devze.com 2023-03-12 08:40 出处:网络
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:

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.


you should handle the form's onsubmit event

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


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

精彩评论

暂无评论...
验证码 换一张
取 消