jquery学习手记(3)属性
生活随笔
收集整理的這篇文章主要介紹了
jquery学习手记(3)属性
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
屬性的格式如下:
$.fn.attr
該格式既可以獲取屬性的值也可以設置屬性的值。示例如下:
設置屬性
1 // Setting attributes 2 $("a").attr( "href", "allMyHrefsAreTheSameNow.html" ); 3 $("a").attr({ 4 title: "all titles are the same too!", 5 href: "somethingNew.html" 6 });獲取屬性
1 // Getting attributes 2 $("a").attr("href"); // returns the href for the first a element in the document?
轉載于:https://www.cnblogs.com/davidwang456/archive/2013/04/13/3018431.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的jquery学习手记(3)属性的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jquery学习手记(2)jQuery对
- 下一篇: jquery学习手记(4)元素的选择与操