Dynamically add a text field whenever clicking on add button in Rails application

156 views Asked by At

I'm developing a food recipe app where a user can post their cooking recipe.
I'm stuck on the part where the user describes the steps for preparation. I want to add a text field for each step. Is there any way to do so?
I am using Rails 7.0.5

I want to have more 'step' fields dynamically.

<%= bootstrap_form_with(model: @recipe, local: true) do |f| %>
    <%= f.text_field :recipe_name %>
    <%= f.email_field :email %>
    <%= f.text_field :step %>
<% end %>

Any methods using javascript or some other gem would be acceptable.

0

There are 0 answers