I think that maybe you are looking for a combination of dojo.place and dojo._toDom (available without underscore in> = 1.7).
The toDom function takes a string and turns it into a DOM element or document fragment.
n = dojo._toDom("<li>foo</li>"); // n is a single DOM node n = dojo._toDom("foo"); // n is a DOM text node n = dojo._toDom("<li>foo</li><li>bar</li>"); // n is a DOM document fragment
The place function also takes a string and a target.
dojo.place("<li>foo</li>", dojo.byId("baz")); // li element is added to // element with id "baz" dojo.place("<li>foo</li>", "baz"); // Same as above. dojo.place("foo", "baz"); // Note: Element with id "foo" // is placed in element with // id "baz" dojo.place(dojo._toDom("foo"), "baz"); // Text node "foo" is placed // in element with id "baz"
Pay attention to the third example: if the line does not start with < , it is considered as the identifier of an element somewhere else in the document.
Btw, the dojo.place function also takes a third-position argument, which can be "first", "last", "replace", "before", "after" (and possibly a few other things).
http://dojotoolkit.org/reference-guide/dojo/place.html
Frode source share