-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhideElement.html
51 lines (42 loc) · 982 Bytes
/
hideElement.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
<html>
<head>
<!-- <style>
body{
background-color: red;
}
div > h1 {
background-color: black;
color: white;
}
</style> -->
<script src="jquery-3.1.0.js" ></script>
</head>
<body>
<h1>Excersize-1</h1>
<div>
<input type="button" name="hide" value="HideInputElement" onclick="hide()"/>
<h1 class="selected">div-1</h1>
<h1 class="selected">div-2</h1>
<!-- form start -->
<!-- hide all input element -->
<form id="main_form">
<p>
<label for="fname">First Name</label>
<input type="text" name="fname" />
</p>
<p>
<label for="lname">Last Name</label>
<input type="text" name="lname" />
</p>
</form>
</div>
<script>
// applying all h1 element that are children to div element
$("div").children(".selected").css("background-color","yellow");
document.body.style.backgroundColor="red";
function hide(){
$("#main_form").hide();
}
</script>
</body>
</html>