Hello, there is such a code
div class="hidden_edit_form" = render "answers/quick", answer: answer It renders the form to edit the answer:
= form_for answer do |f| = f.hidden_field :user_id, :value => current_user.id .field = f.label :text = f.text_area :text .actions = f.submit It turns out that on the page there are for example 10 answers to a question. Initially they are hidden because of the class - hidden_edit_form. Under each answer there is an "Edit" button. How to make it so that when you click on this button, the editing form is opened only for this answer? Now this code:
$(document).ready(function(){ $(".show_edit_form").click(function(){ $(".hidden_edit_form").show(); }); }); It displays all forms for all answers at once, and not just for the particular one selected. In short, it works for all forms hidden under the class hidden_edit_form