2011-09-26 81 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