-
Notifications
You must be signed in to change notification settings - Fork 2
/
dom.js
32 lines (19 loc) · 987 Bytes
/
dom.js
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
//document.querySelector(".heading1").textContent = "hello World";
//const text = "hey there !"
//document.querySelector(".heading1").textContent =text;
// we can things through id or class for id we use # and for class we use dot (.)
// const input = prompt("enter your name !");
// document.querySelector("#heading1").textContent = 'welcome ${input}';
// document.getElementById
// document.getElementsByClassName
// document.getElementsByTagName
// all above can be done by query selector.
// const btn = document.querySelector("#submit") //addeventlistener is function
// btn.addEventListener("click",function (){
// document.querySelector("#heading1").textContent = "The button is clicked by you !";
// })
const btn = document.querySelector("#submit") //addeventlistener is function
const age_input = document.querySelector("#myage")
btn.addEventListener("click",function (){
document.querySelector("#heading1").textContent = `your age is : ${age_input.value}`
})