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

The Archive Base Latest Questions

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

I am working on a personal project involving some jQuery / native Javascript programming.

  • 0

I am working on a personal project involving some jQuery / native Javascript programming. I am hoping somebody can clarify an issue I’m seeing with my code. I’m confused about the relationship among objects created in Javascript and objects that are part of the DOM.

When using JQuery UI (the tabs feature), my program behaves differently depending on whether I manipulate my object from Javascript directory, or if I first access it from the DOM API, which leads me to believe that the two references are not equal.

For Example:

myObject = $(document.createElement("div")).attr("id", "tabs");
$("body").append(myObject);

Now, I have found that the following example works correctly:

$("#tabs").tabs();

But the following does not:

$(myObject).tabs();

Am I correct in assuming that the object I am retrieving via $(“#tabs”) is different or works different than the object I have created manually in Javascript (myObject)?

Is there some mechanism that is invoked once you insert an object into the DOM? Should I not be tinkering with it after I insert it into the DOM, and instead re-retrieve it via its id field?

  • 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-13T07:27:57+00:00Added an answer on May 13, 2026 at 7:27 am

    Creating elements with the raw JS methods is no different to any element referenced with jQuery except that those found by expressions like $(...) are wrapped in a jquery object.

    Since you’re doing this:

    myObject = $(document.createElement("div")).attr("id", "tabs");
    

    you already have a jquery object so you should be able to do this:

    myObject.tabs();
    

    By doing:

    $(myObject).tags();
    

    you’re effectively doing this:

    $($(document.createElement(...)...);
    

    and I’m not sure what the expected behaviour of that is.

    Also bear in mind you can do this (and should favour this way):

    var myObject = $("<div></div>").attr("id", "tabs");
    

    The var makes it local in scope (which is what you want 95% of the time) and you can create arbitrary markup with jquery without using the raw JS methods.

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

Sidebar

Related Questions

I'm working on a personal project involving microphones in my apartment that I can
I'm working on a personal project involving Javascript, and as part of that project,
I'm working on a personal project involving map-making tools for a tabletop game that
I am working on a personal project in winforms just to gain some experience
I have been working on a personal project to get better with programming. My
I am working on a personal project involving sending simple signals from my computer
I am working on a personal project based in PHP and MySQL, and I
I am currently working on a small personal multiplayer game project. I am using
I am working on a personal project where I need to manipulate values in
I am working on a personal project as a way of learning more about

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.