-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTMLWITHJQUERY.HTML
101 lines (89 loc) · 3.05 KB
/
HTMLWITHJQUERY.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<p>
There are hundreds of thousands of wikis in use, both public and private,
including wikis functioning as knowledge management resources, note-taking
tools, community websites, and intranets. Ward Cunningham, the developer
of the first wiki software, WikiWikiWeb, originally described wiki as "the
simplest online database that could possibly work".[3] "Wiki" (pronounced
[wiki][note 1]) is a Hawaiian word meaning "quick".[4][5
</p>
<form>
<label for="">write any text</label>
<textarea></textarea>
</form>
<div
id="div1"
style="
height: 100px;
width: 300px;
border: 1px solid black;
background-color: yellow;
"
>
This is some text in the div.
<p>This is a paragraph in the div.</p>
<p>This is another paragraph in the div.</p>
</div>
<br />
<div
id="div2"
style="
height: 100px;
width: 300px;
border: 1px solid black;
background-color: yellow;
"
>
This is some text in the div.
<p>This is a paragraph in the div.</p>
<p>This is another paragraph in the div.</p>
</div>
<button id="button1">Empty the div element</button>
<button id="button2">Remove div element</button>
<script src="./jquery-3.7.1.js"></script>
<script>
// $("p").click(function () {
// $("p").text("hi");
// });
// $("p").click(function () {
// $("p").html("hi"); // can also change the html but text doesnot
// });
// $("p").click(function () {
// $("p").html("<h1>prachi</h1>"); // can also change the html but text doesnot
// });
// $("p").click(function () {
// $("p").text("<h1>prachi<h1>"); // text will not change the html it will display as it is <h1>prachi<h1>
// });
// $("textarea").click(function () {
// $("textarea").val("prachi"); // val is used to get the form value
// });
$("textarea").dblclick(function () {
$("p").empty(); // val is used to get the form value
});
$("textarea").dblclick(function () {
$("p").remove(); // val is used to get the form value and also removes from the dom or html structure
});
// remove() - Removes the selected element (and its child elements)
// empty() - Removes the child elements from the selected element
// $("#button2").click(function () {
// $("#div1").remove();
// });
// $("#button1").click(function () {
// $("#div2").empty();
// });
// $("div").click(function () {
// $("#div1").addClass("class1"); //revove toggle class
// });
$("div").click(function () {
$("#div1").css("background-color", "red"); //revove toggle class
});
</script>
</body>
</html>