I have an unordened list where each list item is given a data id, I need this ID value to update the view later, basically I cant remove the values from the json, is there a way to hide the value from the html without removing it from the json data? and console.log with a click? The objects are: "level_0_id": 1, "level_1_id": 1, "level_2_id": 1, "id": 1
Here is the code from the fiddle: https://jsfiddle.net/creativestudio/m4t8tszk/1/
Here's the Js:
function list(object) {
        var json="<ul class='dropdown'>";
        for(prop in object){
            var value = object[prop];
            switch (typeof(value)){
                case "object":
                        var token = Math.random().toString(36).substr(2,16);
                        json += "<li><div id='"+ token +"' class='collapse'>"+list(value)+"</div></li>";
                        break;
                        default:
                        json += "<li>"+value+"</li>";
                    }
                }
                return json+"</ul>";
            }
        $(document).ready(function() {
            console.log(data);
            $('#sidebar').html(list(data));
        });
 
     
    