title: How to reference one object on click instead of all with same name
body: <p>I have this structure multiple times in my website, two buttons called leftArrow and rightArrow (same name)  </p>
  
  <pre><code>&lt;div class="row"&gt;
    &lt;ul&gt;
      &lt;li&gt;text&lt;/li&gt;
      &lt;li&gt;text&lt;/li&gt;
      &lt;li&gt;text&lt;/li&gt;
    &lt;/ul&gt;
    &lt;div class="col-12 text-right"&gt;
      &lt;button name="leftArrow" class="btn btn-primary" type="button"&gt;&lt;&lt;/button&gt;
      &lt;button name="rightArrow" class="btn btn-primary" type="button"&gt;&gt;&lt;/button&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When clicked it scrolls the parent ul, this is my code:</p>
  
  <pre><code>$('button[name="leftArrow"]').click(function () {
      var mainSlider = $('button[name="leftArrow"]').parent().prev();
      var leftPos = mainSlider.scrollLeft();
      mainSlider.animate({
          scrollLeft: leftPos - 600
      }, 300);
  });
  
  $('button[name="rightArrow"]').click(function () {
      var mainSlider = $('button[name="rightArrow"]').parent().prev();
      var leftPos = mainSlider.scrollLeft();
      mainSlider.animate({
          scrollLeft: leftPos + 600
      }, 300);
  });
  </code></pre>
  
  <p>this works fine, my problem is all uls get scrolled instead of only the only one who got clicked.</p>
  
  <p>Any solution to referenciate only the ul that contain the button that is being clicked and not all uls?</p>