jquery中prop()方法和attr()方法的區別

tofixed: 四捨五入爲指定小數位數的數字html

tofixed(number)  tofixed(2) 意四捨五入的位數爲兩位ide

 jQuery 1.6 開始新增了一個方法 prop();spa

1.添加屬性名稱該屬性就會生效應該使用prop();
2.是有true,false兩個屬性使用prop();
3.其餘則使用attr();
orm

注:根據官方的建議具備 true 和 false 兩個屬性的屬性,如 checked, selected 或者 disabled 使用prop(),其餘的使用 attr()htm


http://www.cnblogs.com/zhwl/p/3520162.htmlblog

相關文章
相關標籤/搜索