How can I know which option in dropdown menu is selected?
<% @quiz.codes.each do |code| %>
<tr class="quiz_answer" data-code-id="<%= code.id %>">
<td><%= simple_format code.code %></td>
<td><%= simple_format code.notes %></td>
<td><%= form_with(model: [ code, code.student_answers.build ], local: true) do |form| %>
<p>
<%= form.select(:variable_options, code.correct_answers.pluck(:variable, :variable), {prompt: 'Choose variable'}, class: 'answer-variable')%>
<%= form.select(:role_options, code.correct_answers.pluck(:role, :role), {prompt: 'Choose role'}, class: 'answer-role')%>
</p>
<% end %>
</td>
</tr>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…