• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1271
  • Last Modified:

Dojo - Add a ul to a ul

I have a ul on my page with a dojoAttachpoint. I am creating a ul dynamically. I now want to add this ul dynamically to the first ul. Please let me know how this can be done.

Thanks!
0
dshrenik
Asked:
dshrenik
  • 2
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
If you are trying to 'nest' a ul in another one, you need to put it in an 'li' under the first one.

<ul>
<li>content</li>
<li>
      <ul>
      <li>more content</li>
      </ul>
</li>
</ul>

Open in new window

0
 
dshrenikAuthor Commented:
Can you tell me how I can do this dynamically with Dojo? Thanks!
0
 
Dave BaldwinFixer of ProblemsCommented:
No, never heard of Dojo.
0
 
Alan WarrenApplications DeveloperCommented:
Hi dshrenik,
not sure dojocode has a UL tag as such, their dojo.menu is possibly the closest representation I could find, which uses DIV tags to produce the same effect as css cascading menu, which commonly uses UL and LI tags.

Alan
0
 
Alan WarrenApplications DeveloperCommented:
Hi dshrenik,
This might do it too: dojo/html provides useful utilities for managing HTML.

Possibly something like this:
require(["dojo/html", "dojo/dom", "dojo/on", "dojo/domReady!"],
function(html, dom, on){
  on(dom.byId("setContent"), "click", function(){
    html.set(dom.byId("content"), "<ul><li>Item 1></li><li>Item 2</li></ul>");
  });
});

<button type="button" id="setContent">Set Content</button>
<div id="content">I haven't been replaced.</div>

Open in new window

Alan ";0)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now