diff --git a/entries/attr.xml b/entries/attr.xml index 03baf91c..ac3e5a1b 100644 --- a/entries/attr.xml +++ b/entries/attr.xml @@ -26,7 +26,7 @@
The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the .attr()
method sometimes took property values into account when retrieving some attributes, which could cause inconsistent behavior. As of jQuery 1.6, the .prop()
method provides a way to explicitly retrieve property values, while .attr()
retrieves attributes.
For example, selectedIndex
, tagName
, nodeName
, nodeType
, ownerDocument
, defaultChecked
, and defaultSelected
should be retrieved and set with the .prop()
method. Prior to jQuery 1.6, these properties were retrievable with the .attr()
method, but this was not within the scope of attr
. These do not have corresponding attributes and are only properties.
Concerning boolean attributes, consider a DOM element defined by the HTML markup <input type="checkbox" checked="checked" />
, and assume it is in a JavaScript variable named elem
:
Concerning boolean attributes, consider a DOM element defined by the HTML markup <input type="checkbox" checked="" />
, and assume it is in a JavaScript variable named elem
:
@@ -44,12 +44,19 @@ |
elem.getAttribute( "checked" )
|
- "checked" (String) Initial state of the checkbox; does not change |
+ "" (String) Initial state of the checkbox; does not change |
+
---|---|---|---|
+ $( elem ).attr( "checked" )
+ (4.0+)
+ |
+ "" (String) Initial state of the checkbox; does not change |
||
$( elem ).attr( "checked" )
- (1.6+)
+ (1.6-3.x)
|
"checked" (String) Initial state of the checkbox; does not change |