SHOW:
|
|
- or go back to the newest paste.
1 | <script> | |
2 | /* | |
3 | Conditions: | |
4 | 1. Celetti checked - Copricassonetto and/or Persiane not clickable. | |
5 | 2. Motori and/or Avvolgibili checked - Persiane not clickable. | |
6 | 3. Persiane checked - Copricassonetto and/or Celetti not clickable | |
7 | ||
8 | fields: | |
9 | <input type="checkbox" class="form-checkbox" id="input_34_0" name="q34_serviziAggiuntivi[]" value="Celetti" /> | |
10 | <input type="checkbox" class="form-checkbox" id="input_34_1" name="q34_serviziAggiuntivi[]" value="Motori" /> | |
11 | <input type="checkbox" class="form-checkbox" id="input_34_2" name="q34_serviziAggiuntivi[]" value="Avvolgibili" /> | |
12 | <input type="checkbox" class="form-checkbox" id="input_34_3" name="q34_serviziAggiuntivi[]" value="Persiane" /> | |
13 | <input type="checkbox" class="form-checkbox" id="input_34_4" name="q34_serviziAggiuntivi[]" value="Copricassonetto" /> | |
14 | <input type="checkbox" class="form-checkbox" id="input_34_5" name="q34_serviziAggiuntivi[]" value="Zanzariere" /> | |
15 | <input type="checkbox" class="form-checkbox" id="input_35_6" name="q34_serviziAggiuntivi[]" value="Grate" /> | |
16 | */ | |
17 | ||
18 | document.ready(function($) { | |
19 | ||
20 | // general helper functions | |
21 | function disable(check) { | |
22 | $(check).attr('checked', false); | |
23 | $(check).attr("disabled", true); | |
24 | } | |
25 | ||
26 | function enable(check) { | |
27 | $(check).removeAttr("disabled"); | |
28 | } | |
29 | ||
30 | // 1. Celetti checked - Copricassonetto and/or Persiane not clickable. | |
31 | $('#input_34_0').change(function() { | |
32 | if( $(this).is(':checked') ) { | |
33 | disable('#input_34_3'); | |
34 | disable('#input_34_4'); | |
35 | } else { | |
36 | enable('#input_34_3'); | |
37 | enable('#input_34_4'); | |
38 | } | |
39 | }); | |
40 | ||
41 | // 2a. Motori checked - Persiane not clickable. | |
42 | $('#input_34_1').change(function() { | |
43 | if( $(this).is(':checked') ) { | |
44 | disable('#input_34_3'); | |
45 | } else { | |
46 | enable('#input_34_3'); | |
47 | } | |
48 | }); | |
49 | ||
50 | // 2b. Avvolgibili checked - Persiane not clickable. | |
51 | $('#input_34_2').change(function() { | |
52 | if( $(this).is(':checked') ) { | |
53 | disable('#input_34_3'); | |
54 | } else { | |
55 | enable('#input_34_3'); | |
56 | } | |
57 | }); | |
58 | ||
59 | // 3. Persiane checked - Copricassonetto and/or Celetti not clickable | |
60 | $('#input_34_3').change(function() { | |
61 | if( $(this).is(':checked') ) { | |
62 | disable('#input_34_0'); | |
63 | disable('#input_34_4'); | |
64 | } else { | |
65 | enable('#input_34_0'); | |
66 | enable('#input_34_4'); | |
67 | } | |
68 | - | }.bind(window, jQuery)); |
68 | + | |
69 | }.bind(window, jQuery)); | |
70 | </script> |