I have a the following static div:
<body>
<div id="div1"></div>
....
I want to add a div with id "div1_1" within div1 dynamically by using dojo. How can I do it?
I have a the following static div:
<body>
<div id="div1"></div>
....
I want to add a div with id "div1_1" within div1 dynamically by using dojo. How can I do it?
Another option using flexible dojo.place:
dojo/dom-construct also can be used for creating new nodes.
A sample usage is as follows;
dojo/dom-construct arguments are
you can checkout the documentation for more information.
You can do it using just Dojo Base — no need to include anything, if you use the trunk or Dojo 1.3:
This line creates a div with id "div1_1" and appends it to the element with id "div1". Obviously you can add more attributes and styles in one go — read all about it in the documentation for dojo.create().
This is a good way, it helps get past some node referencing issues in IE7 and you can continue to use the reference to the divNode later.