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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:55:39+00:00 2026-05-27T23:55:39+00:00

I am constructing a div and appending it to a main div. While doing

  • 0

I am constructing a div and appending it to a main div. While doing this I need to get the height of the div as soon as I construct it and before appending it.

For Example,

<script>
$(function(){
var text = $("#ObjText").html(); // This text is dynamic

var dv = $("<div id='childDiv'>"+text+"</div>");
alert($(dv).height()); // This is getting '0' - Need to get the height of the div here.

$("#page").append(dv);

//After appending to page able to get the height of the child div
alert($("#childDiv").height());
});
</script>

In my body Tag,

<body>
<div id="page"></div>
</body>

Please help me out on this. Thanks in advance.

  • 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-27T23:55:40+00:00Added an answer on May 27, 2026 at 11:55 pm

    I don’t think you can get height of any object you create in runtime before appending it to the document.

    jQuery executes and gets result of all DOM ready object available on the document(your html) There fore before appending u cannot get the height.

    If you still want to get the height i can suggest u a temporary place div on html where you can append your current div and check the height. if you want you and append the div where you want later.

    Hope the above helps you to find the solution…

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

Sidebar

Related Questions

I need height on the div 50px in default and it has to be
I am trying to construct equivalent of this code in JSF2 <form action=/search.xhtml method=get>
I have this construction: <a onclick=toggle_media_box(); return false; href=# class=media_link> <div id=media_link class=media_link></div> </a><br
Im constructing an array of objects like this: var postData = []; $.each(selectedFields, function
I'm very sure a variation of this has been asked before, and my asking
Given a DIV with this general structure (class=post, from an extracted message board post)
Given: Constructing an ADO Connection object from one thread and giving it to another
I'm constructing a simple form in ERB but the HTML produced by the text_field
I am constructing a search page with a textbox and a button for now,
I'm constructing a method to take in an ArrayList(presumably full of objects) and then

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.