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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:16:26+00:00 2026-05-27T07:16:26+00:00

When trying to append one div to another Im finding that this doesn’t work:

  • 0

When trying to append one div to another Im finding that this doesn’t work:

 var htmlCell = jQuery('<div id="ddd"></div>').attr({ 'className': "basecell" }).css({ 'top': 165 + 'px' }).css({ 'left': 335 + 'px' }).css({ 'background-color': '#ffffff' });
 $("#dtest").append(htmlCell);

but this does:

 var htmlCell = jQuery('<div id="ddd"></div>').css({ 'height': 165 + 'px' }).css({ 'width': 165 + 'px' }).css({ 'position': 'absolute' }).css({ 'top': 165 + 'px' }).css({ 'left': 335 + 'px' }).css({ 'background-color': '#ffffff' });
 $("#dtest").append(htmlCell);

With the CSS below:

#dtest
{    
    position: relative;
    top: 0px;
    left: 50px;
    height: 469px;
    width: 685px;
    z-index: 86;
    background-color: #000000;
}
.basecell
{
    position: absolute;
    width: 116px;
    height: 116px;
    background-color: #ffffff;

}

In both cases the children().length of #dtest is 1 but in the statement that uses a class it is not visible. Any ideas?

  • 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-27T07:16:27+00:00Added an answer on May 27, 2026 at 7:16 am
    var htmlCell = jQuery('<div id="ddd"></div>').addClass("basecell").css({ 'top': 165 + 'px' }).css({ 'left': 335 + 'px' }).css({ 'background-color': '#ffffff' });
    $("#dtest").append(htmlCell);
    

    You can also do:

    $('<div id="ddd">').addClass("basecell").css({ 'top': 165 + 'px', 'left': 335 + 'px', 'background-color': '#ffffff }).appendTo($("#dtest"));
    

    There is no attribute called className. If you want to set class name to an element using jQuery, you have to use $(elem).addClass('classname') method. Conversely, you can remove a class using $(elem).removeClass('classname'). To remove all classes, use $(elem).removeClass().

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

Sidebar

Related Questions

I'm using jQuery 1.5.2 trying to dynamically load a div from one source into
I am trying to append one list with another . If i pass a
i am trying to remove the div old image and append a new one
I'm trying to work with a jQuery script I found at http://marcgrabanski.com/articles/scrollto-next-article-button-jquery that allows
Trying to pull info from one JSON datafeed and use that to make another
Im trying to write a JQuery wrapper extension that takes a content div and
I'm trying to append a string of svg elements to the dom. This is
I'm trying to use jQuery to append a row to a table and to
What I'm trying to do here is make one function that does all the
I have a function that requires some vars being appended to a div. One

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.