Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

remove bad advice to use .attr() method #202

Merged
merged 1 commit into from

2 participants

@rmurphey
Collaborator

fix #199

@addyosmani
Collaborator

Merging. Thanks!

@addyosmani addyosmani merged commit be21e32 into jquery:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 25, 2012
  1. @rmurphey
This page is out of date. Refresh to see the latest.
View
18 page/using-jquery-core/faq/how-do-i-check-uncheck-a-checkbox-input-or-radio-button.md
@@ -3,24 +3,12 @@ title: How do I check/uncheck a checkbox input or radio button?
source: http://docs.jquery.com/Frequently_Asked_Questions
---
-There are two ways to check/uncheck a checkbox/radio button.
-
-Set the 'checked' attribute to true or false.
-
-```
-// Check #x
-$("#x").attr( "checked", true );
-
-// Uncheck #x
-$("#x").attr( "checked", false );
-```
-
-Add or remove the 'checked' attribute:
+You can check or uncheck a checkbox element or a radio button using the `.prop()` method:
```
// Check #x
-$("#x").attr( "checked", "checked" );
+$("#x").prop( "checked", true );
// Uncheck #x
-$("#x").removeAttr("checked");
+$("#x").prop( "checked", false );
```
View
18 page/using-jquery-core/faq/how-do-i-disable-enable-a-form-element.md
@@ -3,24 +3,12 @@ title: How do I disable/enable a form element?
source: http://docs.jquery.com/Frequently_Asked_Questions
---
-There are two ways to disable/enable form elements.
-
-Set the 'disabled' attribute to true or false:
-
-```
-// Disable #x
-$("#x").attr( "disabled", true );
-
-// Enable #x
-$("#x").attr( "disabled", false );
-```
-
-Add or remove the 'disabled' attribute:
+You can enable or disable a form element using the `.prop()` method:
```
// Disable #x
-$("#x").attr( "disabled", "disabled" );
+$("#x").prop( "disabled", true );
// Enable #x
-$("#x").removeAttr("disabled");
+$("#x").prop( "disabled", false );
```
Something went wrong with that request. Please try again.