Reputation: 137
I am new in rails.I have a "drop down" which contains values 1 to 10 in "index page" like:
<% @offers.each do |f|%>
<%= f.select :Conditions.......%>
In "show page" i have many div
with visibility is equal to false.So, i want to show div by the selected value.
For example if i select 5
and pressing the submit button then i want to show only 5 div
.
Is there any other way to get the same result.
Upvotes: 0
Views: 41
Reputation: 3036
You can do that using change event of your select, as example:
$('#offers_conditions').change(function(){
var val = $(this).val();
$('.class-for-all-divs').hide();
$('#' + val).show();
});
Upvotes: 1