I want to loop over the array lists_indexes to update several lists of values in my HTML page.
Currently, I update a single such list through:
$('#List_1').html("<%= escape_javascript(options_for_select(@values, disabled: @disabled)) %>")
How do I loop over lists_indexes to update List_2, ..., List_n?
What you need is this, you dont need to loop over in CoffeScript, you can loop via ruby
<% list_indexes.each do |i| %>
$("#List_<%= i %>").html("<%= escape_javascript(options_for_select(@values, disabled: @disabled)) %>")
<% end %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With