2011-09-26 99 views

回答

2
$(document).ready(function(){ 
    $("div img[alt^='slide']").each(function(i, item){ 
    var imageAlt = $(item).attr("alt"); 
    var text = "this is " + imageAlt + "."; 
    console.log(imageAlt); 
    $("ul a").eq(i).text(text); 
    }); 
}); 

小提琴:http://jsfiddle.net/maniator/g33H8/1/

+0

說什麼也沒做。我的html已經有1-5硬編碼,但它應該說有slide1替代文字,slide2替代文字等... – heyjohnmurray

+0

@ thursday0384看到我的更新^ _^ – Neal

+0

謝謝尼爾!我覺得我在正確的軌道上。現在我可以回去看看。每一個更近一點。 – heyjohnmurray