简体   繁体   中英

Jquery facebox disabling button

I am trying to disable the fillin button and enable it later. I thought i could just remove the attr href and rel from the anchour and add them again when i want it enabled but it still works even after i remove the href and rel. It must initialise before they are removed

$('#fillin').fadeTo("fast", .5).removeAttr("href"); 
$('#fillin').fadeTo("fast", .5).removeAttr("rel");

$('#fillin').attr('href', '#info');
$('#fillin').attr('rel', 'facebox');



$('a[rel*=facebox]').facebox({
        loadingImage : 'images/loading.gif',
        closeImage   : 'images/closelabel.png'
      });

<a id="fillin" href="#info" rel="facebox"><img border="0" src="images/getprice.png"/></a>

Thanks

Lee

To disable:

$('#fillin').bind('click', false);

To reenable:

$('#fillin').unbind('click', false);

This may or may not work depending on how Facebox attaches it's event handlers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM