Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8927543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:14:32+00:00 2026-06-15T08:14:32+00:00

I have 20 divs with a similar structure, and within it a close button

  • 0

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();
  });

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:14:33+00:00Added an answer on June 15, 2026 at 8:14 am
    <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 >.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three divs, within a content div. Container width 70%. Within that I
I have divs that I want to display at specific times throughout the day.
Have three divs in a container that I want to float over a large
I have 2 divs that positioned horizontally ( float:left; width:50%; ). But i want
I use this to number divs that have the class number: $(#parent .number).each(function(i){ $(this).html((i+1)
An example of fragments that have identical hierarchical structure: (1) <div> <span>It's a message</span>
I have have multiple divs' with similar code within it, but also has a
I have a series of divs that have similar ids with the exception of
I have two divs, one within the other. The outer div (the container) is
I have several similar links that trigger different navigation divs to appear. I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.