Attributes
.attr() 方法
设置:
$( "a" ).attr( "href", "allMyHrefsAreTheSameNow.html" );
$( "a" ).attr({
title: "all titles are the same too!",
href: "somethingNew.html"
});
取得:
// 返回文档中,第一个<a>元素的 href 属性值
$( "a" ).attr( "href" );
.attr() 方法
设置:
$( "a" ).attr( "href", "allMyHrefsAreTheSameNow.html" );
$( "a" ).attr({
title: "all titles are the same too!",
href: "somethingNew.html"
});
取得:
// 返回文档中,第一个<a>元素的 href 属性值
$( "a" ).attr( "href" );