aboutsummaryrefslogtreecommitdiffstats
path: root/tests/visual/checkboxradio/checkboxradio.html
blob: 8d26daeff17ffe33118dfd32754f724c13d51eef (plain)
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
62
63
64
65
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>jQuery UI - Checkboxes</title>
	<link rel="stylesheet" href="../../../themes/base/all.css">
	<script src="../../../external/jquery/jquery.js"></script>
	<script src="../../../ui/core.js"></script>
	<script src="../../../ui/widget.js"></script>
	<script src="../../../ui/button.js"></script>
	<script src="../../../ui/checkboxradio.js"></script>
	<script>
	$(function() {
		var checkboxes = $( "form input" ).checkboxradio();

		$( ".controls input, .controls select" ).on( "change keyup", function() {
			var option = $( this ).attr( "name" ),
				value = $( this ).val();

			if ( $( this ).is( "[type=checkbox]" ) ) {
				value = $( this ).is( ":checked" );
			}
			if ( option != "label" || value !== "" ) {
				checkboxes.checkboxradio( "option", option, value );
			}
		});
		$( ".controls > button" ).on( "click", function() {
			if ( this.id !== "create" ) {
				checkboxes.checkboxradio( this.id );
			} else {
				checkboxes.checkboxradio();
			}
		});
	});
	</script>
	<style>
	#format { margin-top: 2em; }
	</style>
</head>
<body>
<h2>
	Easy way to toggle through various combinations of options and states to make sure none lead to
	a broken appearence.
</h2>
<div class="controls">
	<button id="create">Create</button>
	<button id="destroy">Destroy</button>
	<button id="enable">Enable</button>
	<button id="disable">Disable</button>
	<button id="refresh">Refresh</button>
	<input type="checkbox" id="icon" name="icon" checked><label for="icon">Icon</label>
	<input type="checkbox" id="disabled" name="disabled"><label for="disabled">Disabled</label>
	<label for="label">Label<input type="text" id="label" name="label"></label>
</div>
<form>
	<input type="checkbox" id="checkbox-1">
	<label for="checkbox-1">Checkbox widget sample</label>
	<input type="checkbox" id="checkbox-2"><label for="checkbox-2">Checkbox widget sample</label>

	<label for="radio-1">Radio widget sample <input type="radio" id="radio-1" name="radio" checked></label>
	<input type="radio" id="radio-2" name="radio"><label for="radio-2"><span>boom</span>Radio widget sample 2</label>
	<button type="reset">Reset</button>
</form>
</body>
</html>