-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
112 lines (102 loc) · 2.56 KB
/
index.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script>
<script>
/* $(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
*/
/* $(document).ready(function(){
$("p").click(function(){
$("p").hide();
})
$
})
*/
//This below script will hide the id selector text.
/* $(document).ready(function(){
$("button").click(function(){
$("#test").hide();
});
});
$(document).ready(function(){
$("h2").dblclick(function(){
$(".heading-test").hide();
})
})
$(document).ready(function(){
$("#test").mouseenter(function(){
alert("You entered test!");
});
});
$(document).ready(function(){
$(".heading-test").mouseleave(function(){
alert("You left heading test");
});
});
//mousehover function
$(document).ready(function(){
$("#test").hover(function(){
alert("You entered test div");
},
function(){
alert("You leave this area");
});
});
*/
//focus function and blur function
$(document).ready(function(){
$("input").focus(function(){
$(this).css("background-color", "#cccccc");
});
$("input").blur(function(){
$(this).css("background-color","#fff");
});
});
//on method:it attaches one or more event handlers for the selected elements.//this is multiple
$(document).ready(function(){
$("#test").on({
mouseenter: function(){
$(this).css("background-color", "lightgray");
},
mouseleave: function(){
$(this).css("background-color", "lightblue");
},
click: function(){
$(this).css("background-color","yellow");
}
});
});
//hide and show function
$(document).ready(function(){
$("#hide").click(function(){
$("p").hide(1000);
});
$("#show").click(function(){
$("p").show(500);
});
});
//use of toggle
$(document).ready(function(){
$("button").click(function(){
$("p").toggle();
});
});
</script>
</head>
</body>
<p>If you click me, I will disappear.</p>
<p>click me away</p>
<p>clic me too</p>
<h1 id="test">This is another page</h1>
<button>click me</button>
<h2 class="heading-test">This is second heading</h2>
Name: <input type="text" name="fullname"><br>
Email: <input type="text" name="email">
<p>See the Game</p>
<button id="hide">Hide me </button>
<button id="show">Show me </button>
</html>