title: link_to_add and link_to_remove - clicking on them dynamically
body: <p>I am using a gem <a href="https://github.com/ryanb/nested_form" rel="nofollow">https://github.com/ryanb/nested_form</a> and I have a model which has <code>accepts_nested_attributes_for</code>. While it works nice, sometimes I want to be able add / remove (mostly add) a form on a page which is always added / removed by a button:</p>
  
  <pre><code>.row
    #tasks
      = f.fields_for :tasks do |task_form|
        ..............
  
        = task_form.link_to_remove "Remove", class: "btn btn-danger"
        = f.link_to_add  "Add task", :tasks, class: "btn btn-default", data: { target: "#tasks" }
  </code></pre>
  
  <p>In other words, I want to click on <code>link_to_add</code> and <code>link_to_remove</code> dynamically (not by mouse), probably by calling a method on it which should exist in <code>nested_form</code> gem. Of course, I can that by javascript by <strong>triggering click event</strong> for the button but my gut tells me there must be a simpler, more natural way to do so. Is there any?</p>
  
  <p><strong>update</strong>:</p>
  
  <p>I'm ok with javascript, of course. I'm not really ok with <strong>triggering</strong> click event for the button as there must be a simpler and standard way in <code>nested_form</code>.</p>