我有一大堆divs
,它們有一個名爲ofint
的類。他們每個人都可能有其他課程。我想存儲有關每個div的信息,然後打印出來。在jquery中創建和打印數組
因此,我試圖循環遍歷類ofint
的所有div,並將div id
及其classes
存儲在一個數組中。我的想法是,我將在稍後搜索數組,但現在我需要創建它並確保它存儲正確的信息。
我有一些想法如何到達那裏,但不能完全做到這一點。如何完成此操作,然後打印陣列以進行雙重檢查?
var myarr = new array;
$(".ofint").each(function(){
//store the div id and div classes in the array
myarr[this.id][classes] = //the list of classes;
});
//print the array here
作品完全相同的方式,我需要它。非常感謝。 – lok 2010-08-21 03:09:12