使用jQuery,如何分割陣列或分配鍵,jQuery的
我有一個數組結果
[<a href=""><img src="image1"></a>,<a href=""><img src="image2"></a>]
,如果我嘗試做每一個我只得到在數組中的第一個,
我怎麼會分裂這個,所以我可以做
$.each(my_array, function (index, value) {
this.parent().attr.('href',this.src);// assign image as href to parent
});
這裏是壞的嘗試
請注意,上面的數組返回到我的imagesLoaded的jQuery插件和我canot直接選擇父母,因爲它是沒有結果的範圍內,ZI必須element.parent去() 任何幫助表示讚賞。日Thnx!
this.parrent()!? *母公司*! – Baz1nga
typo parrent =>父 – coolguy
是thnx固定但仍然相同的問題 – Benn