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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:25:33+00:00 2026-05-13T09:25:33+00:00

Can I add an object of Elements inside another DOM element using grab or

  • 0

Can I add an object of Elements inside another DOM element using grab or inject or anything else?

There are two items in the object, both of type Element that are created through Javascript:

var firstElem = new Element("div", {text: "something"}); // <div>something</div>
var secondElem = new Element("div", {text: "else"});     // <div>else</div>
var myDivs = new Elements([firstElem, secondElem]);

myDivs contains both the elements (firstElem, secondElem) as an array and I want to add this myDivs object to the DOM element below, using something like $("container").grab(myDivs). So the DOM state before adding looks like:

<div id="container"></div>

After adding, it looks like:

<div id="container">
    <div>something</div>
    <div>else</div>
</div>

But I’m getting this error when calling $("container").grab(myDivs):

Uncaught Error: NOT_FOUND_ERR: DOM Exception 8

I could add each Element to the container one by one, but am wondering if there’s a way to add an object of Elements directly due to the way my solution is architected.

  • 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-13T09:25:34+00:00Added an answer on May 13, 2026 at 9:25 am

    You ought to use .adopt() instead. See this example on jsBin: http://jsbin.com/anayu

    window.addEvent("domready", function(){ 
    
      var firstElem  = new Element("div", {text: "something"}); 
      var secondElem = new Element("div", {text: "else"}); 
      var myDivs     = new Elements([firstElem, secondElem]); 
    
      $("container").adopt(myDivs); 
    
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When creating lots of DOM elements, document.createElement and friends can add lots of bytes
So I know that you can add an object in java to something through
since method Add() takes Object as an argument, can I add for example datatables,
Why should we add an object name to a QObject? I can still load
We can add an image to an photo album using UIImage *img = [UIImage
While we can add Inline Images in paragraphs there does not appear to be
Can someone please tell me how to change tab by clicking on element INSIDE
I have an id<NSFastEnumeration> object. I want to count the elements inside the object.
I have a situation when there's a table and you can add a new
I can't add an element of type T into a list List[T] . I

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.