Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created November 13, 2010 23:18
Show Gist options
  • Save walterdavis/675735 to your computer and use it in GitHub Desktop.
Save walterdavis/675735 to your computer and use it in GitHub Desktop.
function toggleInputs(){
//replace the placeholder names below
var inputs = $('theNameOfYourSecondaryBox').select('input,select,textarea');
var checkbox = $('theIdOfYourCheckbox');
//all the rest of this can stay the same
if(checkbox.checked){
inputs.invoke('disable');
}else{
inputs.invoke('enable');
}
}
//be sure this matches the name of the box also
$('theIdOfYourCheckbox').observe('click',toggleInputs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment