John Resig schrieb: > $.fn.checked = function(b) { > if ( b ) > this.attr( "checked", "checked" ); > else > this.removeAttr( "checked" ); > }; > > What do you think? > How about this: $.fn.checked = function(b) { if( typeof b == 'boolean') { if(b) { this.attr('checked, 'checked'); } else { this.removeAttr('checked'); } else { return this.attr('checked'); } }
Could then be categorized within DOM/Attributes, as it aligns nicely with the rest of the set/get methods. -- Jörn _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/