Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- /*
- Conditions:
- 1. Celetti checked - Copricassonetto and/or Persiane not clickable.
- 2. Motori and/or Avvolgibili checked - Persiane not clickable.
- 3. Persiane checked - Copricassonetto and/or Celetti not clickable
- fields:
- <input type="checkbox" class="form-checkbox" id="input_34_0" name="q34_serviziAggiuntivi[]" value="Celetti" />
- <input type="checkbox" class="form-checkbox" id="input_34_1" name="q34_serviziAggiuntivi[]" value="Motori" />
- <input type="checkbox" class="form-checkbox" id="input_34_2" name="q34_serviziAggiuntivi[]" value="Avvolgibili" />
- <input type="checkbox" class="form-checkbox" id="input_34_3" name="q34_serviziAggiuntivi[]" value="Persiane" />
- <input type="checkbox" class="form-checkbox" id="input_34_4" name="q34_serviziAggiuntivi[]" value="Copricassonetto" />
- <input type="checkbox" class="form-checkbox" id="input_34_5" name="q34_serviziAggiuntivi[]" value="Zanzariere" />
- <input type="checkbox" class="form-checkbox" id="input_35_6" name="q34_serviziAggiuntivi[]" value="Grate" />
- */
- document.ready(function($) {
- // general helper functions
- function disable(check) {
- $(check).attr('checked', false);
- $(check).attr("disabled", true);
- }
- function enable(check) {
- $(check).removeAttr("disabled");
- }
- // 1. Celetti checked - Copricassonetto and/or Persiane not clickable.
- $('#input_34_0').change(function() {
- if( $(this).is(':checked') ) {
- disable('#input_34_3');
- disable('#input_34_4');
- } else {
- enable('#input_34_3');
- enable('#input_34_4');
- }
- });
- // 2a. Motori checked - Persiane not clickable.
- $('#input_34_1').change(function() {
- if( $(this).is(':checked') ) {
- disable('#input_34_3');
- } else {
- enable('#input_34_3');
- }
- });
- // 2b. Avvolgibili checked - Persiane not clickable.
- $('#input_34_2').change(function() {
- if( $(this).is(':checked') ) {
- disable('#input_34_3');
- } else {
- enable('#input_34_3');
- }
- });
- // 3. Persiane checked - Copricassonetto and/or Celetti not clickable
- $('#input_34_3').change(function() {
- if( $(this).is(':checked') ) {
- disable('#input_34_0');
- disable('#input_34_4');
- } else {
- enable('#input_34_0');
- enable('#input_34_4');
- }
- });
- }.bind(window, jQuery));
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement