if (typeof data.feedback != "undefined") { create_feed(data.feedback); $('td.name:contains("feedback")').parent().parent().css('background-color', ' #fcf3cf'); } create_table(data.idea_description); create_info(); Object.keys(data).forEach(val => { console.log(val); let sub = data[val] ; if (sub == null) { console.log("null"); } else { if (typeof sub === 'object'){ console.log(val); if (val == "business_goals"){ Object.keys(sub).forEach(v => { console.log("here"); var child = $('#mygoal')[0].content.cloneNode(true); console.log("there"); $('textarea.goal',child).val(v); $('textarea.objective',child).val(sub[v][0]); $('#businessg').append(child); for (let i = 1; i < sub[v].length; i++) { var child = $('#myobjective')[0].content.cloneNode(true); $('textarea.objective',child).val(sub[v][i]); $('#businessg').append(child); } }); } else if (val == "customer_goals") { Object.keys(sub).forEach(v => { var child = $('#mycgoal')[0].content.cloneNode(true); $('textarea.cgoal',child).val(v); $('textarea.cobjective',child).val(sub[v][0]); $('#customerg').append(child); for (let i = 1; i < sub[v].length; i++) { var child = $('#mycobjective')[0].content.cloneNode(true); $('textarea.cobjective',child).val(sub[v][i]); $('#customerg').append(child); } }); } else { Object.keys(sub).forEach(v => { if($("#"+v).length > 0) { var elem = $("#"+v)[0].tagName; console.log(v,sub[v]); console.log(elem); if (elem == "TEXTAREA"){ $("#"+v).append(sub[v]); } else if (elem == "INPUT" || elem == "SELECT") { $("#"+v).val(sub[v]); } else if (elem == "DIV") { $("#"+v+"_label").append("Currently available document: " + sub[v] + ""); } } }); } } else { $("#"+val+"_label").append("Currently available document: " + data[val] + ""); } } }); selected_roles(data.resources_estimation); var resources = data.resources_allocation; list_resources(resources); trigger_textarea();