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 7823185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:09:31+00:00 2026-06-02T08:09:31+00:00

Possible Duplicate: jQuery: find all the parents up to a specific parent I have

  • 0

Possible Duplicate:
jQuery: find all the parents up to a specific parent

I have the following:

<div class="modal-window block-border">
    <ul class="action-tabs right">
        <li><a title="Close window" href="#"><img width="16" height="16" src="images/icons/fugue/cross-circle.png"></a></li>
    </ul>
    <div class="block-content no-title">
        <div style="min-width: 200px; min-height: 40px; width: 300px; height: 221px;" class="modal-content modal-scroll">
            <h1>Admin</h1>
            <div class="block-header">
                Please login
            </div>
            <form novalidate="novalidate" action="/MyAccount/Access/JsonLogin" data-ajax="true" data-ajax-method="POST" data-ajax-mode="replace" data-ajax-success="dialogSuccess()" data-ajax-update="#update-message" name="login-form" id="login-form" method="post">

I have a reference to the form which is $(this). Given this reference how can I find a reference to the class with the top most div called “modal-window” ?

  • 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-02T08:09:32+00:00Added an answer on June 2, 2026 at 8:09 am

    Because you might not be sure of exactly how far the target element is from the current element, and assuming you only want to find one target element:

    $(this).closest('.modal-window');
    
    • parent() selects the immediate-parent element of $(this), returns a jQuery object of one, or none.
    • parents() selects all matching ancestor elements of $(this), returns a jQuery object of one, none or many.
    • closest() selects the first element matching the selector in the DOM ‘tree’ above the $(this), returns a jQuery object of one, or none.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Detect element content changes with jQuery I have a div with a
Possible Duplicate: Find and Replace more than 1 word? I want to use jQuery
Possible Duplicate: How to access this attribute using jquery, given a div defined by
Possible Duplicate: How to get all of the IDs with jQuery? How can i
Possible Duplicate: jQuery $(this) vs this In jquery sometimes I find that within a
Possible Duplicate: Please explain JSONP For example in the jQuery documentation I find both
Possible Duplicate: How to change the href for a hyperlink using jQuery I have
Possible Duplicate: Where can I find a tutorial to get started learning jQuery? Considering
Possible Duplicate: click link below a higher z-index div I have a small question.
Possible Duplicate: Nested jQuery.each() - continue/break Here is my code: var steps = $(div#f);

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.