jQueryによる、属性変更

2009年06月10日(水)
セレクタ.attr("属性名");

でそのセレクタの属性を取得できます。
title = $(“img”).attr(“title”);

変更する場合は、

セレクタ.attr("属性名","値");

となるらしいです。

多くの属性を変更する場合は

$("img").attr({
 src: "/images/hat.gif",
 title: "jQuery",
 alt: "jQuery Logo"
});