Dynamically enable/disable checkboxes in a form.

For a project I’m working on I need a way to disable/enable checkboxes in a form based on which option the user selects from a dropdown list. The easy way would have been to split it up in two forms, the user selects the option from the dropdown list, submits the form and the page reloads and shows the appropriate checkboxes but that’s not what I wanted, it should be dynamic. I knew I had to look at javascript to get this done.

For this example I’ll do everything inline and not use separate files.

Read the rest of this entry »