Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to structure JSON and build HTML via jQuery
    primarykey
    data
    text
    <p>Beginner here trying to figure out best way to structure some JSON and output the below nested &lt;ul&gt;</p> <p>Each of the bolded items below are the values in the JSON. How might I structure the JSON and then how to build the DOM structure with jQuery? Any help greatly appreciated.</p> <p><code><pre>&lt;ul&gt; &lt;li&gt;<strong>Topic 1</strong> &lt;ul&gt; &lt;li id="<strong>foo_item1a</strong>"&gt; &lt;a href="<strong>destination_Item1a</strong>"&gt; &lt;strong&gt;<strong>Lorem</strong>&lt;/strong&gt; &lt;span&gt;<strong>Item 1a</strong>&lt;/span&gt; &lt;em&gt;<strong>Ipsum</strong>&lt;/em&gt; &lt;/a&gt; &lt;/li&gt; &lt;li id="<strong>foo_item1b</strong>"&gt; &lt;a href="<strong>destination_Item1b</strong>"&gt; &lt;strong&gt;<strong>Dolor</strong>&lt;/strong&gt; &lt;span&gt;<strong>Item 1b</strong>&lt;/span&gt; &lt;em&gt;<strong>Sit</strong>&lt;/em&gt; &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;<strong>Topic 2</strong> &lt;ul&gt; &lt;li id="<strong>foo_item2a</strong>"&gt; &lt;a href="<strong>destination_Item2a</strong>"&gt; &lt;strong&gt;<strong>Lorem</strong>&lt;/strong&gt; &lt;span&gt;<strong>Item 2a</strong>&lt;/span&gt; &lt;em&gt;<strong>Ipsum</strong>&lt;/em&gt; &lt;/a&gt; &lt;/li&gt; &lt;li id="<strong>foo_item2b</strong>"&gt; &lt;a href="<strong>destination_Item2b</strong>"&gt; &lt;strong&gt;<strong>Dolor</strong>&lt;/strong&gt; &lt;span&gt;<strong>Item 2b</strong>&lt;/span&gt; &lt;em&gt;<strong>Sit</strong>&lt;/em&gt; &lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt;</p> <p></pre></code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload