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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:53:45+00:00 2026-05-20T17:53:45+00:00

I have some HTML with the following approximate structure and positioning: <div class=grand-parent style=position:

  • 0

I have some HTML with the following approximate structure and positioning:

<div class="grand-parent" style="position: absolute">
  <div class="parent" style="position: relative">
    <div class="child"></div>
  </div>
</div>

In my jQuery widget, I’m trying to insert an element that is located inside the “offset parent” of the element targeted by the widget. To do so, I essentially have code like this:

var targetElement = $('.child');
$('<div/>').appendTo(targetElement.offsetParent());

Unfortunately, the element appears to be inserted as a child of .grand-parent instead of parent. My understanding of offsetParent() (and the documentation seems to back this) is that offsetParent() should return .parent because it is positioned relative. Is my understanding of offsetParent incorrect, or is there a problem with jQuery (I’m using 1.4.1).

  • 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-20T17:53:45+00:00Added an answer on May 20, 2026 at 5:53 pm

    According to https://developer.mozilla.org/en/DOM/element.offsetParent, offsetParent doesn’t work as I had expected if the parent is not displayed (display: none). In my case, the container element is just that.

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

Sidebar

Related Questions

I have some html like the following: <div class=control-group> <input type=text data-bind=value: $data.DealCode name=DealCode
So I have some html that looks like the following: <div class='something unknown' id='something_unknown_1'>
I have the following html <div class=someClass> Some text </div> <div class=someClass> Some other
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have the following html code: <div id=result1 class=result> ... some html ... ...
I have the following HTML <div id=nav class=red> some more HTML here </div> The
I have some recursive HTML in the following tree structure: div.item div.content input div.container
I have some code similar to the following: In myapp.html <template name=problems> <div class=problems>
I have some HTML that looks like this: <div class=MyClass></div> <div class=MyClass></div> <div class=MyClass></div>
I have the following html code: <div class= modal id=indexModal> <span class=thing></span> <a href=#

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.