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

  • Home
  • SEARCH
  • 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 4083834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:21:48+00:00 2026-05-20T18:21:48+00:00

Is there an easy way in jQuery to return the owner form for a

  • 0

Is there an easy way in jQuery to return the owner form for a deeply-nested checkbox (or input) element? Here’s an example of what I mean:

<form>
    <table>
        <thead>
            <tr>
                <td>123</td>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td><input type="checkbox" class="checkall" /></td>
            </tr>
        </tfoot>
    </table>
</form>

Then I have the following jQuery code:

$('checkbox.checkall').each(function() { 
    // Access form element of the checkbox here
});

In the above example, I would like to obtain the form to which the checkbox belongs. Natually, I could do this using a chained parent() method, but the checkbox might not always be the same nesting depth from the root form element.

Sorry if it’s not clear, but it’s difficult to explain.

  • 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-05-20T18:21:48+00:00Added an answer on May 20, 2026 at 6:21 pm

    Get the closest form

    $("input[type=checkbox]").closest("form");
    

    From jQuery API:

    Description: Get the first ancestor element that matches the selector, beginning at the current element and progressing up through the DOM tree.

    .closest( selector )

    selector: A string containing a selector
    expression to match elements against.

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

Sidebar

Related Questions

Is there an easy way to create a multiline string literal in C#? Here's
Is there an easy way to make multiple changes to the css in jQuery
When I have finally finished my jQuery plugin, is there an easy way to
Is there an easy way to change the color of a jQuery UI Button?
Is there an easy way to convert jQuery code to regular javascript? I guess
Is there an easy way to populate one form field with duplicate content from
Is there an easy way, for example, to drop an XML name space, but
Is there an easy way to check in a unit test that two arrays
Is there an easy way to detect when a .NET app gets or loses
Is there an easy way to use DirectX in Java? In particular, DirectX's video

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.