title: How to pass dynamically generated div's id to javascript in Rails
body: <p>I am creating a list of buttons in Rails dynamically.</p>
  
  <pre><code>  &lt;ul&gt;
       &lt;% @exams.each do |exam| %&gt;
         &lt;li&gt;&lt;%= link_to exam.name, card_exam_path(:id =&gt; exam.id), :class =&gt; 'simple-button course-type', :method =&gt; :get %&gt;
          &lt;div class="edit_#{exam.name}"&gt;&amp;nbsp;&lt;/div&gt;&lt;/li&gt;
        &lt;% end %&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>Now I need to access the edit_#{exam.name} div in dynamically. For every dynamically generated div I need to trigger 'click' event.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      *******Here I need to access all the divs seperately. How do I do that?
  
  
  &lt;/script&gt;
  </code></pre>