[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dojo - Add a ul to a ul

Posted on 2012-08-24
7
Medium Priority
?
1,268 Views
Last Modified: 2012-08-28
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
Comment
Question by:dshrenik
  • 2
  • 2
5 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38330702
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
 

Author Comment

by:dshrenik
ID: 38331765
Can you tell me how I can do this dynamically with Dojo? Thanks!
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 38331772
No, never heard of Dojo.
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 2000 total points
ID: 38344166
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
 
LVL 26

Expert Comment

by:Alan Warren
ID: 38344182
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Simple Linear Regression

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question