Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy can't I unbind event based on checkbox state?
    primarykey
    data
    text
    <p>I am trying to attach an event listener to a checkbox only if it is <strong>not checked</strong>. But the event (firing an overlay) happens even if I try to check it. </p> <ol> <li><p>Go to this page: <a href="http://eetest.netmagicsolutions.com/leadform/" rel="nofollow">http://eetest.netmagicsolutions.com/leadform/</a></p></li> <li><p>Select Hosting option from the dropdown</p></li> <li><p>Try clicking on the Dedicated Hosting Checkbox</p></li> </ol> <p>You will see that the overlay fires even if I uncheck the checkbox.</p> <p>Here is my code:</p> <pre><code>$grpBoxes.fireReveal = function($input) { //fire overlay only if input is not checked $input.on('change.overlay', function(e) { console.log($input.attr('checked')); if($input.is(':checked')) { $input.overlay({ onBeforeLoad: function(){ console.log('ready to fire'); $input.addClass('fired'); }, // load it immediately after the construction load:true, // disable this for modal dialog-type of overlays closeOnClick: false }); } else { $input.removeClass('fired'); $input.off('change.overlay'); console.log($input.attr('checked')); return false; } }); // end callback }; // end fireReveal </code></pre> <p>Here is my live code: <a href="http://eetest.netmagicsolutions.com/leadform/" rel="nofollow">http://eetest.netmagicsolutions.com/leadform/</a> Here is my full script: <a href="http://eetest.netmagicsolutions.com/leadform/js/jquery.leadform.js" rel="nofollow">http://eetest.netmagicsolutions.com/leadform/js/jquery.leadform.js</a></p> <p>What am I doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload