-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexample.html
61 lines (61 loc) · 1.89 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Dependent field example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="jquery.dependent.fields.js"></script>
</head>
<body>
<h1>Dependent Fields Example</h1>
<form action="#">
<h3>Checkbox</h3>
<p>
<label for="master-checkbox">
Master Checkbox
</label>
<input id="master-checkbox" type="checkbox"/>
</p>
<p>
<label for="dependent-field1">
Depends on Master 1
</label>
<input id="dependent-field1" class="depends-on-master-checkbox" type="text"/>
</p>
<p>
<label for="dependent-field2">
Depends on Master 2
</label>
<textarea id="dependent-field2" class="depends-on-master-checkbox"></textarea>
</p>
<h3>Dropdown</h3>
<p>
<label for="master-dropdown">
Master Dropdown
</label>
<select id="master-dropdown">
<option value="">-- Select a Country --</option>
<option value="Canada">Canada</option>
<option value="France">France</option>
<option value="Germany">Germany</option>
<option value="United States">United States</option>
</select>
</p>
<p>
<label for="dependent-dropdown">
Dependent Dropdown
</label>
<select id="dependent-dropdown">
<option value="">-- Select a State / Territory --</option>
<option value="Alabama">Alabama</option>
<option value="Saskatchewan">Saskatchewan</option>
</select>
</p>
<input type="submit"/>
</form>
</body>
<script>
$('.depends-on-master-checkbox').dependsOn('#master-checkbox');
$('#dependent-dropdown').dependsOn('#master-dropdown', ['Canada', 'United States']);
</script>
</html>