// my code $(document).ready(() => { // Data let SkillData = [ { "Profession": "Blacksmith", "Items": [ ["ingot_iron", { "Level": 1, "Difficulty": 16, "Durability": 40, "Name": "Iron Ingot" }], ["ingot_iron", { "Level": 1, "Difficulty": 20, "Durability": 40, "Name": "Iron Ingot" }], ["ingot_iron", { "Level": 1, "Difficulty": 36, "Durability": 40, "Name": "Iron Ingot" }], ["ingot_iron", { "Level": 1, "Difficulty": 50, "Durability": 40, "Name": "Iron Ingot" }], ["ingot_iron", { "Level": 1, "Difficulty": 16, "Durability": 40, "Name": "Iron Ingot" }] ], "Image": "img/blacksmith.png" } ]; let LoadItems = (id) => { str = ''; let i = 0; SkillData[id].Items.forEach(job => { str += `
${job[1].Name}
Lv. ${job[1].Level}
'+job[1].Name+'
Lv. '+job[1].Level+'
') $thing.attr('ident', i) $('#crafting-itemlist').append($thing) $($thing).click(function() { let num = $(this).attr('ident') let difficulty = (SkillData[id].Items[num][1].Difficulty) let durability = (SkillData[id].Items[num][1].Durability) let name = (SkillData[id].Items[num][1].Name) let itempic = SkillData[id].Items[num][0] console.log(num) }) i++ }) }