-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBCCOTOggleClick.html
More file actions
38 lines (30 loc) · 1012 Bytes
/
BCCOTOggleClick.html
File metadata and controls
38 lines (30 loc) · 1012 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>Background Color Change On Toggle Click</title>
<meta charset="utf-8">
<meta name="viewport" content="width=width-device, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="BCCOTOggleClick.css">
<script type="text/javascript" src="jQuery.min.js"></script>
</head>
<body>
<div class="wrapper">
<input type="checkbox" name="toggle" class="custom-toggle">
</div>
<script type="text/javascript">
$(".custom-toggle").each(function (i){
var classes = $(this).attr("class"),
id = $(this).attr("id"),
name = $(this).attr("name");
$(this).wrap('<div class="custom-toggle" id="' + name + '"></div');
$(this).after('<label for="custom-toggle-' + i + '"></label>');
$(this).attr("id", "custom-toggle-" + i);
$(this).attr("name", name);
});
$(".custom-toggle input").change(function (){
$("body").toggleClass("green");
});
</script>
</body>
</html>
<!--HTML & jQuery is completed!-->