Horje
jquery nested ul li Code Example
jquery nested ul li
function buildList(data) {
    var $ul = $('<ul></ul>');
    for (const key in data) {
        var $child = $('<li></li>');
        $ul.append($child)
        if (typeof data[key] === 'object') {
            $child.text = $child.text(key);
            $child.append(buildList(data[key]));
        } else {
            $child.text = $child.text(key + ' : ' + data[key]);
        }
    }
    return $ul;
}
jquery nested ul li
jQuery(document).ready(function($) {

$.get('url', function(data){

            var $ul = $('<ul></ul>');

            function getList(item, $list) {

                $.each(item, function (key, value) {
                    var $li = $('<li />');
                    $li.append($('<a rel="nofollow" href="#">' + key + '</a>'));

                    var $subul = $("<ul/>");

                    $.each(value, function(i) {
                        var subli = $('<li/>')
                        .text(value[i])
                        .appendTo(subli);
                    });
                    $subul.append(subli);


                    $li.append($subul)

                });
            }
            getList(data, $ul);
            $ul.appendTo("div_containing_ul");
    });});




Javascript

Related
scrape data from ao3 Code Example scrape data from ao3 Code Example
reorder them so that more specific routes come before less specific routes Code Example reorder them so that more specific routes come before less specific routes Code Example
how ot make a background color faor evaluationbutton in flutter Code Example how ot make a background color faor evaluationbutton in flutter Code Example
mdn includes Code Example mdn includes Code Example
react js error stackoverflaw Code Example react js error stackoverflaw Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7