Reputation: 1289
I have jquery which renders a value inside an html element
<div id="serialsNewFormatted"></div>
Which is nothing but a number/integer. Now I want to pass value rendere inside the above code into my form's hidden_field
.
How do I do it?
Thanks
UPDATE: I need to pass the value inside the rails form hidden field, something like <%= f.hidden_field :data, :value => ValueGoesHere %>
Upvotes: 0
Views: 1511
Reputation: 5625
Assume
<input type="hidden" id="hiddenObject"/>
then
you need below code
$("#hiddenObject").val($("#serialsNewFormatted").html());
Upvotes: 1