jQuery Adding DOM Elements
Posted
by Aren B
on Stack Overflow
See other posts from Stack Overflow
or by Aren B
Published on 2010-04-21T16:54:27Z
Indexed on
2010/04/21
17:03 UTC
Read the original article
Hit count: 386
This may be a simple answer, but I'm trying to add a dom-created element (i.e. document.createElement(...)
) to a jQuery Selector.
jQuery has a great assortment of functions for adding html
- .html(htmlString)
- .append(htmlString)
- .prepend(htmlString)
But what i want to do is add a dom OBJECT
var myFancyDiv = document.createElement("div");
myFancyDiv.setAttribute("id", "FancyDiv");
// This is the theoretical function im looking for.
$("#SomeOtherDiv").htmlDom(myFancyDiv);
© Stack Overflow or respective owner