-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasic.html
33 lines (30 loc) · 849 Bytes
/
Basic.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
<!DOCTYPE html>
<html>
<body>
<div>
<input type="text" id="newString"/>
<button onClick="printString()">Confirm</button>
<button onclick="printVar()">Stored</button>
</div>
<div>
<div id="newValue">Change value</div>
<button onClick="changeValue()">change</button>
</div>
<script>
var newString = ""
function printString(){
newString = document.getElementById("newString").innerHTML
console.log("clicked")
console.log(newString)
}
function printVar(){
console.log(newString)
}
function changeValue(){
if(newString && newString !== null){
document.getElementById("newValue").innerHTML = newString
}
}
</script>
</body>
</html>