> > $.fn.checked = function(b) {
> >    if ( b || b == undefined )
> >        this.attr( "checked", "checked" );
> >    else
> >        this.removeAttr( "checked" );
> > };

> I strongly suggest you to compare if a variable is equal to 
> undefined using the typeof unary operator, because if you, 
> someday, dicide to get these things work on IE 5, you can not 
> compare to the undefined constant (?), after all, it doesn't 
> exist on IE 5.0. Compare like this one:
> 
> if(b || typeof b == 'undefined') { ...

No need to go to the extra work. jquery.js begins with this:

window.undefined = window.undefined;

So "undefined" exists in every browser. This is a handy line of code to put
in any JavaScript - it's completely compatible with both old and new
browsers.

-Mike


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to