Thanks, I'll actually give that a try.

On Jan 11, 9:46 am, Ariel Flesler <afles...@gmail.com> wrote:
> I just made a plugin to do EXACTLY what you're asking for.
> It's not formally released yet so there's no documentation. If you
> want, you can use it.
>
> http://test.flesler.com/jquery.broadcast/
>
> Note that it requires jQuery 1.3. That means you need to use the
> version on trunk or any of the recently released betas.
>
> Cheers
> --
> Ariel Fleslerhttp://flesler.blogspot.com
>
> On Jan 9, 5:30 pm, kape <erlend.so...@gmail.com> wrote:
>
> > I have created custom styled buttons in my page and would like to
> > toggle their class and therefore their look when they get disabled or
> > enabled.  So is there any way to call a function when .removeAttr
> > ('disabled'), .attr('disabled', ''), and .attr('disabled', 'disabled')
> > are invoked?  Basically, is there any way to have enable/disable act
> > like an event such as click, mouseover, etc.?
>
> > I've tried overwriting the jQuery function as follows:
>
> >         jQuery.fn.removeAttr = function(name) {
> >           if(this.eq(0).hasClass('buttonDisabled') && name ==
> > 'disabled')
> >             this.eq(0).removeClass('buttonDisabled');
> >           jQuery.attr(this.get(0), name, "" );
> >           if (this.get(0).nodeType == 1)
> >             this.get(0).removeAttribute(name);
> >         };
>
> > and when $('.buttonDisabled').removeAttr('disabled') is called, the
> > disabled attribute and buttonDisabled class are removed.  This is what
> > I want, but it doesn't seem right.  I shouldn't be overwriting the
> > removeAttr function.  Also, I'd have to do the same thing for jQuery's
> > attr() function to add the buttonDisabled class when .attr('disabled',
> > 'disabled') is called.  Can I add the code I need to the functions and
> > then call "super" somehow?  Is there a simpler way to achieve what I
> > want?

Reply via email to