-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopycontentjq.html
117 lines (101 loc) · 2.69 KB
/
copycontentjq.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
113
114
115
116
117
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>jQuery Demo</title>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.container {
display: flex;
justify-content: space-around;
margin: 20px;
}
.list {
border: 1px solid #ccc;
padding: 10px;
width: 150px;
}
#list1, #list2 {
list-style: none;
padding: 0;
margin: 0;
cursor: pointer;
}
#list1 li, #list2 li {
margin-bottom: 5px;
padding: 10px;
background-color: #f2f2f2;
border-radius: 4px;
transition: background-color 0.3s ease;
}
#list1 li:hover {
background-color: #ddd;
}
#clearBtn {
padding: 10px;
background-color: #e44d26;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
margin-top: 20px;
transition: background-color 0.3s ease;
}
#clearBtn:hover {
background-color: #d14024;
}
#nextPage {
display: none;
margin-top: 20px;
text-align: center;
}
#nextPage h2 {
margin: 0;
}
</style>
</head>
<body>
<div class="container">
<div class="list" id="list1">
<h3>List 1</h3>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
</ul>
</div>
<div class="list" id="list2">
<h3>List 2</h3>
<ul></ul>
</div>
</div>
<button id="clearBtn">Clear</button>
<div id="nextPage">
<h2>This is the Next Page</h2>
<!-- Add content for the next page here -->
</div>
<script>
// Copy contents from list1 to list2 on click
$('#list1 li').on('click', function() {
$('#list2 ul').append($(this).clone());
});
// Clear the contents of list2 on clear button click
$('#clearBtn').on('click', function() {
$('#list2 ul').empty();
});
</script>
</body>
</html>