-
-
Save cohitre/1337920 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tanga.initialize '#upsell', -> | |
select = $('#upsell select') | |
notice = $('#upsell p.notice') | |
// more readable checkbox selector | |
checkbox = $('#upsell :checkbox') | |
callback = -> | |
// Let's only check the value of $(this), easier to debug if there is more than one checkbox. | |
notice.toggle $(this).is(":checked") | |
// select is a jQuery element, use jQuery methods to disable it. | |
if $(this).is(":checked") | |
select.attr("disabled", 'disabled') | |
else | |
select.removeAttr("disabled") | |
true | |
// removing this, the value gets set when you trigger the change() event | |
// select.disabled = true | |
// bind the callback and trigger it. | |
checkbox.change(callback).change() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment