Register onclick events from dynamically created div array? Rails + Jquery?
问题 After failing to achieve this with link_to remote, I decided to try jQuery way. Here is the jQuery loop and the rails loop and how they interact. Problem is I getting to register clicks only on one of the div's out of each loop, so the thing is not really working.. Here is the code: <% @node.parent_relation.videos.each_with_index do |vid, idx| %> <%= image_tag("http://img.youtube.com/vi/#{vid.content}/1.jpg", :id => "img_div_#{idx}") %> <div id="vid_vid_<%=idx%>" style="display: none"> <%=