Rats, that's what I thought (that's the whole point behind being disabled, right?).
I may drop a div on top, but I've got another idea up my sleeve. Thanks for the confirmation :) On Dec 20, 7:04 pm, Oskar Krawczyk <[email protected]> wrote: > I'm afraid disabled buttons will not accept any event. What you could > do is: > > a) When you disable the button, add an invisible DIV on top of the > button and add the appropriate event to that element. > > b) Store the status (disabled or enabled) inside Storage (ie. > this.store('current:mode', true)) and fake the disabling by fading the > button out or something. > > Best, > Oskar > > > > rpflo wrote: > > So I've got some disabled buttons and I'd like to display a message > > why it is disabled if they try to click on it. > > > They get enabled and disabled dynamically, so I can't add an event to > > the buttons that are disabled on domready. > > > So here's some code that hopefully shows what I'm trying to do. (I put > > everything in so you can copy and paste quickly if you so desire). > > > If you click it once it will display "enabled" and then disabled it. > > Click it again it does nothing. I'd like to display a message that > > it's disabled, and then enable it again. Any tips? > > > Thanks! > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > > > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> > > <head> > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> > > > <title>untitled</title> > > <script type="text/javascript" src="js/mootools.js"></script> > > <script type="text/javascript"> > > window.addEvent('domready',function(){ > > $('disabledTest').addEvent('click',function(){ > > disabled = this.get('disabled'); > > if(disabled) { > > alert('disabled!'); > > this.set('disabled',false); > > } else { > > alert('enabled!'); > > this.set('disabled',true); > > } > > }); > > }); > > </script> > > </head> > > > <body> > > <p> > > <button id="disabledTest">Test</button> > > </p> > > > </body> > > </html>
