Skip to content

Commit 99531cf

Browse files
dom:chores
1 parent 65b4e64 commit 99531cf

4 files changed

Lines changed: 135 additions & 0 deletions

File tree

‎getStarted/js/dropdown.html‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>DOM Manipulation</title>
6+
<style>
7+
.bro {
8+
display: none;
9+
}
10+
body {
11+
font-family: Arial, sans-serif;
12+
background-color: #494949;
13+
color: white;
14+
}
15+
.main,
16+
body {
17+
display: flex;
18+
flex-direction: column;
19+
align-items: center;
20+
justify-content: center;
21+
}
22+
button {
23+
padding: 10px 20px;
24+
font-size: 16px;
25+
margin-top: 20px;
26+
cursor: pointer;
27+
}
28+
.text {
29+
font-size: 20px;
30+
}
31+
</style>
32+
</head>
33+
<body>
34+
<div class="main">
35+
<div class="text">THis is the main text</div>
36+
<button>Hide</button>
37+
38+
39+
</div>
40+
</body>
41+
<script>
42+
const buttons = document.querySelector("button");
43+
const text = document.querySelector(".text");
44+
45+
buttons.addEventListener("click", () => {
46+
text.classList.toggle("bro");
47+
if (text.classList.contains("bro")) {
48+
buttons.textContent = "show";
49+
} else {
50+
buttons.textContent = "hide";
51+
}
52+
});
53+
</script>
54+
</html>

‎getStarted/js/reduce-map-forEach.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ const userNames = letslearnUsersObject.filter(function(user){
4444
}).reduce(function(acc,user){
4545
return acc + user
4646
},0)
47+
48+
49+
50+
51+
52+
4753
console.log(userNames)
4854
// const userNamesFor = [];
4955
// function getUserNames(users){

‎getStarted/jsAdvance/dom.html‎

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<style>
8+
.btn{
9+
padding: 10px 20px;
10+
font-size: 1.1em;
11+
color:white;
12+
background-color: #007BFF;
13+
border: none;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<button class="btn" >Click Me</button>
19+
<div>
20+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint, repellendus quasi!
21+
</div>
22+
<div class="second">
23+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint, repellendus quasi!
24+
</div>
25+
<div>
26+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint, repellendus quasi!
27+
</div>
28+
<div>
29+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Sint, repellendus quasi!
30+
</div>
31+
32+
</body>
33+
<script>
34+
//dom (Documnet object model ) ever element is an object in js
35+
//we can manipulate the element using js
36+
const btn = document.querySelector(".btn");
37+
// btn.addEventListener("work",function)
38+
btn.addEventListener("click",handelClick);
39+
function handelClick(){
40+
if(btn.textContent === "Click Me"){
41+
btn.style.backgroundColor = "green";
42+
btn.textContent = "Clicked";
43+
}
44+
else{
45+
btn.style.backgroundColor = "#007BFF";
46+
btn.textContent = "Click Me";
47+
}
48+
49+
}
50+
btn.addEventListener("mouseover",function(){
51+
if(btn.textContent === "Clicked"){
52+
}
53+
else{
54+
btn.style.backgroundColor = "red";
55+
}
56+
})
57+
btn.addEventListener("mouseout",function(){
58+
if(btn.textContent === "Click me"){
59+
60+
btn.style.backgroundColor = "#007BFF";
61+
}
62+
})
63+
64+
65+
//click ,hover ,mouseout ,keydown ,
66+
67+
68+
69+
70+
71+
72+
</script>
73+
74+
</html>

‎getStarted/task/task2.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Instructions for Students:
77
Setup the Inventory (Array of Objects):
88

99
Create an empty array called inventory.
10+
1011
Create a function called createProduct(name, price, quantity).
1112
This function should return an object with those three properties.
1213
Call this function three times to create these items and add them to your inventory array:

0 commit comments

Comments
 (0)