ruby on rails - Getting multiple selected options with javascript from collection_select, RoR -
i have view in ruby on rails application there 2 collect_selects on right side, 1 of list of users , other list of objects has :multiple => true. when user has selected user , @ least 1 object want display chart on right side user , whichever objects have been selected (likely using gem flot). have seen how selected object using selected_index, i'm stumped how can array of of selected objects when multiple selections allowed. hoping in javascript without having submit button or anything, possible?
i found own answer. of selected objects in javascript, example in collection_select id "user_id" need use:
$("#user_id option:selected").each(function() { // whatever $(this).text() or $(this).val() each option. });
Comments
Post a Comment