Added test for attr('checked', {true|false}) (bug #167)
[jquery.git] / src / jquery / jquery.js
index d214137..9b9cfa4 100644 (file)
@@ -435,6 +435,10 @@ jQuery.fn = jQuery.prototype = {
         *
         * @test $("#name").attr('name', 'something');
         * ok( $("#name").name() == 'something', 'Set name attribute' );
+        * @test $("#check2").attr('checked', true);
+        * ok( document.getElementById('check2').checked == true, 'Set checked attribute' );
+        * $("#check2").attr('checked', false);
+        * ok( document.getElementById('check2').checked == false, 'Set checked attribute' );
         *
         * @name attr
         * @type jQuery
@@ -3158,24 +3162,31 @@ jQuery.macros = {
                },
 
                /**
-                * Binds a particular event (like click) to a each of a set of match elements.
-                *
-                * @example $("p").bind( "click", function() { alert("Hello"); } )
+                * Binds a handler to a particular event (like click) for each matched element.
+                * The event handler is passed an event object that you can use to prevent
+                * default behaviour. To stop both default action and event bubbling, your handler
+                * has to return false.
+                *
+                * @example $("p").bind( "click", function() {
+                *   alert( $(this).text() );
+                * } )
                 * @before <p>Hello</p>
-                * @result [ <p>Hello</p> ]
-                *
-                * Cancel a default action and prevent it from bubbling by returning false
-                * from your function.
+                * @result alert("Hello")
                 *
                 * @example $("form").bind( "submit", function() { return false; } )
+                * @desc Cancel a default action and prevent it from bubbling by returning false
+                * from your function.
                 *
-                * Cancel a default action by using the preventDefault method.
-                *
-                * @example $("form").bind( "submit", function() { e.preventDefault(); } )
+                * @example $("form").bind( "submit", function(event) {
+                *   event.preventDefault();
+                * } );
+                * @desc Cancel only the default action by using the preventDefault method.
                 *
-                * Stop an event from bubbling by using the stopPropogation method.
                 *
-                * @example $("form").bind( "submit", function() { e.stopPropogation(); } )
+                * @example $("form").bind( "submit", function(event) {
+                *   event.stopPropagation();
+                * } )
+                * @desc Stop only an event from bubbling by using the stopPropagation method.
                 *
                 * @name bind
                 * @type jQuery