What about to just receive one parameter
It's working with checked, disabled and readonly...
$.fn.extend({
toggleAttr : function( attrib ) {
if ( this.attr( attrib ) ) {
this.removeAttr( attrib );
} else {
this.attr( attrib, attrib );
}
return this;
}
});