原文:
http://api.jquery.com/prop/#prop-propertyName-value
The .prop()
method is a convenient way to set the value of properties—especially when setting multiple properties, using values returned by a function, or setting values on multiple elements at once. It should be used when setting selectedIndex
, tagName
, nodeName
, nodeType
, ownerDocument
, defaultChecked
, or defaultSelected
. Since jQuery 1.6, these properties can no longer be set with the .attr()
method. They do not have corresponding attributes and are only properties.
反正現在應該沒什麼機會再去用jQuery 1.4以前的版本了吧
今天為了讓GridView標題上的CheckBox被勾選時, 就能把整個GridView的所有CheckBox全部勾選或清除, 又不想用c#, 所以想用jQuery在前端作
結果去網路上亂抄程式, 找到用Attr()的版本, 試不出來, 浪費了一個多小時
呿, 我要下班去吃燒臘飯了