javascript - Dynamic Select Menu in Rails -
i'm trying implement dynamic select menu in rails application, following youtube video #88 .
i set video, javascript doesn't work should.
my view code: _form.html.erb
<div class="field"> <%= f.label :cliente_id %><br> <%= f.collection_select :cliente_id, cliente.order(:name), :id, :name, include_blank: true %> </div> <div class="field"> <%= f.label :projeto_id %><br> <%= f.grouped_collection_select :projeto_id, cliente.order(:name), :projetos, :name, :id, :name, include_blank: true %> </div>
relatos.coffe ->
jquery -> projetos = $('#relato_projeto_id').html() $('#relato_cliente_id').change -> cliente = $('#relato_cliente_id :selected').text() options = $(projetos).filter("optgroup[label='#{cliente}']").html() if options $('#relato_projeto_id').html(options) else $('#relato_projeto_id').empty()
the page seems ok, no errors, when list cliente(client) should list projects listed him, keeps showing projects there no jquery @ all.
the starting of code jquery when should jquery. person said before, see.
Comments
Post a Comment