开发者

Using jQuery to pull values from a select element

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜