Q:

how to find relative nearby elements with jquery

I have 20 divs with a similar structure, and within it a close button that i want to use to submit a form:
<div id="product_1">
  <button type="button" class="close-div"</button>  <!!!! the close button!!!
  <div class="span6">
    <div class="row">
      <div class="span2">
        <p>content</p>
      </div>
      <div class="span4">
        <h2>content</h2>
        <%= form_for(product, :remote => true) do |f| %>
          <div id="slider_product_1"</div>
          <%= f.hidden_field :value, :id => "value_product_1", class: "product-value" %>
          <%= f.submit 'Ready', :id => "submit_product_1", :class => "submit-button" %>
        <% end %>
      </div>
    </div>
  </div>
</div>

I have tried with siblings, parent, children, this, find and Either nothing gets sent, or the form gets sent like 20 times (there are 20 forms in the page with similar structure). Any help would be inmensely appreciated
<script type='text/javascript'>
  $(".close-div").on("click", function() {
    $(this).siblings().children(".product-value").val(2);
    $(this).siblings().children(".submit-button").click();
    $(this).parent().slideUp();
  });

A:

<script type='text/javascript'>
  $(".close-div").on("click", function() {
    var $parent = $(this).parent();
    $parent.find(".product-value").val(2);
    $parent.find(".submit-button").click();
    $parent.slideUp();
  });
</script>

also make sure you close your <button> tag.  Looks like it's missing a >.

