My initial view code: view/clubs_registration/clubs/test_dropzone_pictures.html.erb
<%= render partial: 'dropzone_pictures', :locals => { :club_id => @club.id } %>
My partial code contains a hidden field: view/clubs_registration/clubs/_dropzone_pictures.html.erb
<%= hidden_field_tag :club_id, name: :club_id, value: club_id %>
The generated HTML of my partial looks like this:
<input id="club_id" name="club_id" type="hidden" value="{:name=>:club_id, :value=>11500}">
What I really want to do is retrieve the value of club_id from my jquery:
console.log($("#club_id").val()); //-> {:name=>:club_id, :value=>11500}
I just want the value 11500. How should I do that please?
尝试将value
键设置为club_id[:value]
:
<%= hidden_field_tag :club_id, name: :club_id, value: club_id[:value] %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.