jQuery - 使用要点 - Attributes

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013275171/article/details/85313611

Attributes

.attr() 方法

设置:

$( "a" ).attr( "href", "allMyHrefsAreTheSameNow.html" );
 
$( "a" ).attr({
    title: "all titles are the same too!",
    href: "somethingNew.html"
});

取得:

// 返回文档中,第一个<a>元素的 href 属性值
$( "a" ).attr( "href" );

猜你喜欢

转载自blog.csdn.net/u013275171/article/details/85313611