title: how to add separate links for a container and a button in it
body: <p><a href="https://i.stack.imgur.com/8x2ZE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8x2ZE.png" alt="enter image description here"></a></p>
  
  <p>I have a course container that links to the course show page. the container also has a button that allows you to enroll in a course.</p>
  
  <p>But right now the enroll button doesn't work and just redirects to the course show page.</p>
  
  <p>How can I get the enroll button to work while keeping the container link?</p>
  
  <p>Heres my code:</p>
  
  <pre><code>&lt;%= link_to course_path(course) do %&gt;
     &lt;div class="container hidden-xs hidden-sm hidden-lg" style="border: solid 1px black; padding: 10px; width: 70%; padding-left: 50px; padding-top: 15px; padding-bottom: 15px; margin-top: 10px; margin-bottom: 10px;"&gt;
       &lt;div class="row col-centered"&gt;
         &lt;div class="hidden-xs hidden-sm col-md-2 col-lg-2 index"&gt;
           &lt;%= image_tag(course.courseimage, :size =&gt; 100) %&gt;
         &lt;/div&gt;
         &lt;div class="hidden-xs hidden-sm col-md-6 col-lg-6 index" style="margin-left: 20px;"&gt;
           &lt;h3&gt;&lt;%= course.name %&gt;&lt;/h3&gt;
           &lt;p&gt;&lt;%= course.shortdescription %&gt;&lt;/p&gt;
         &lt;/div&gt;
         &lt;div class="hidden-xs hidden-sm col-md-2 col-lg-2"&gt;
           &lt;% if course.price == 0 %&gt;
             &lt;%= form_for(current_user.enrolments.build) do |f| %&gt;
               &lt;div&gt;&lt;%= hidden_field_tag :course_id, course.id %&gt;&lt;/div&gt;
               &lt;%= f.submit "Enroll", class: "btn button", style: "margin-left:10px;  padding-top: 10px; padding-bottom: 10px; font-size: 1.25em; position: relative; bottom: 50%; transform: translateY(50%); width: 130%; color: white !important;"%&gt;
             &lt;% end %&gt;
           &lt;% end %&gt;
         &lt;/div&gt;
       &lt;/div&gt;
     &lt;/div&gt;
     &lt;% end %&gt;
  </code></pre>