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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:27:41+00:00 2026-05-30T03:27:41+00:00

Okay I’m really not sure what I’m doing wrong here but the div is

  • 0

Okay I’m really not sure what I’m doing wrong here but the div is not created and I don’t know why?

$('#tree_01').draggable({appendTo: 'body', helper: 'clone', stop: function(event, ui) {
                var bg_pos_x = -5;
                var bg_pos_y = -1516;
                var width = 148;
                var height = 174;
                var pos_x = $(ui.helper).position().left;
                var pos_y = $(ui.helper).position().top;
                var id = 'tree_'+pos_x+'_'+pos_y;
                folliage(id,bg_pos_x,bg_pos_y,width,height,pos_x,pos_y);
            }});

When the draggable element is dropped it should run the code and go to the following function:

function folliage(id,bg_pos_x,bg_pos_y,width,height,pos_x,pos_y){
    var newdiv = document.createElement('div');
    newdiv.setAttribute('id', id);
    document.getElementById(id).style.left=pos_x+'px';
    document.getElementById(id).style.zIndex='5';
    document.getElementById(id).style.left=pos_y+'px';
    document.getElementById(id).style.width=width+'px';
    document.getElementById(id).style.height=height+'px';
    document.getElementById(id).style.background='url(../img/village.png)';
    document.getElementById(id).style.backgroundPosition=bg_pos_x+'px '+bg_pos_y+'px';

}

but the div doesn’t get created????

  • 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-30T03:27:43+00:00Added an answer on May 30, 2026 at 3:27 am

    You never actually add the div to the page. You need to use something like append to add the div to the DOM.

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

Sidebar

Related Questions

Okay i know i have to use the JDBC etc, but im not sure
Okay, I know I have to be doing something wrong here because the performance
Okay, I really know this has GOT to be the long way around doing
Okay, so the answer to my question might not be the problem but here's
Okay, I'm pretty sure that this is not possible but a client had asked
Okay, so this is a long long shot but here it goes... When IE
Okay, I have setup up a handler for a div click but for some
Okay, this should be really simple, but I have searched all over for the
Okay I do apologise that I'm out of my depth here. I'm not the
Okay, so this is the line that's returning null. What am I doing wrong

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.