By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,963 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,963 IT Pros & Developers. It's quick & easy.

<div> tags

100+
P: 184
Hi All,
In my dojo grid application, want to create <div> tag inside another <div> tag by using document.createElement('DIV');
I done as follows

Expand|Select|Wrap|Line Numbers
  1.  var outerNode = document.createElement('DIv');
  2.  outerNode .setAttribute('dojoType','dijit.Menu')
  3.  document.body.appendChild(outerNode );
  4.  var innerNode1 = document.createElement('DIv');
  5.  innerNode1 .setAttribute('dojoType','dijit.MenuItem);
  6. innerNode1 .innerHTML='cut';
  7.  document.body.appendChild(innerNode1 );
  8.  
  9.  var innerNode2 = document.createElement('DIv');
  10.  innerNode2 .setAttribute('dojoType','dijit.MenuItem);
  11. innerNode2 .innerHTML='copy';
  12. document.body.appendChild(innerNode2);
  13.  
  14.  var innerNode3 = document.createElement('DIv');
  15.  innerNode3 .setAttribute('dojoType','dijit.MenuItem);
  16. innerNode3 .innerHTML=paste;
  17. document.body.appendChild(innerNode3);
  18.  
when i tried to print document.body.innerHTML i got
Expand|Select|Wrap|Line Numbers
  1. <div dojoType="dijit.Menu"></div>
  2.       <div dojoType="dijit.MenuItem">cut</div>
  3.       <div dojoType="dijit.MenuItem">copy</div>
  4.       <div dojoType="dijit.MenuItem">paste</div>
  5.  
Hence the functionality is not working for me..
Expected is
Expand|Select|Wrap|Line Numbers
  1. <div dojoType="dijit.Menu">
  2.       <div dojoType="dijit.MenuItem">cut</div>
  3.       <div dojoType="dijit.MenuItem">copy</div>
  4.       <div dojoType="dijit.MenuItem">paste</div>
  5. </div>
How do i do?
Please correct me.. if i'm wrong
Feb 16 '09 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
you have to append the inner nodes to the outer node like this:

Expand|Select|Wrap|Line Numbers
  1. outerNode.appendChild(innerNode3);
kind regards
Feb 16 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.