-2
我想追加此項目的div,但它沒有工作......這裏是我的代碼:追加項目的div
$("document").ready(function(){
var aMenu = [{
title: "Home",
image: "/Icons/1.png",
items: [
{ title: "about", w: "x", h: "y", image: "/Images/1-1.PNG" },
{ title: "feature", w: "x", h: "y", image: "/Images/1-2.PNG" },
{ title: "themes", w: "x", h: "y", image: "/Images/1-3.PNG" },
{ title: "typography", w: "x", h: "y", image: "/Images/1-4.PNG" },
{ title: "look", w: "2x", h: "y", image: "/Images/1-5.PNG" }
]
}];
var dv = ("#dvTitleMenu");
for (i = 0; i < aMenu.length; i++) {
$("#dvTitleMenu")
.append("<div class='col6'><a href='#'><h2>"+aMenu(i).title+"</h2></a></div>");
}
});
*什麼*沒有工作,怎麼樣?你有沒有得到任何錯誤?請您格式化您的代碼並解釋您的問題,最好包括指向小提琴或codepen的鏈接;現在,不可能知道你的問題是什麼。 –
但有一點突出:'aMenu(i)'是無效的語法,你可能是指'aMenu [i]'。 –