forked from rocketacademy/basics-blackjack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttonselector.js
More file actions
33 lines (27 loc) · 1.12 KB
/
Copy pathbuttonselector.js
File metadata and controls
33 lines (27 loc) · 1.12 KB
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
var standButton = document.querySelector("#stand-button");
var hitButton = document.querySelector("#hit-button");
var newgameButton = document.querySelector("#newgame-button");
standButton.addEventListener("click", function () {
// Set result to input value
var input = document.querySelector("#stand-button");
var result = main(input.value);
// Display result in output element
var output = document.querySelector("#output-div");
output.innerHTML = result;
});
hitButton.addEventListener("click", function () {
// Set result to input value
var input = document.querySelector("#hit-button");
var result = main(input.value);
// Display result in output element
var output = document.querySelector("#output-div");
output.innerHTML = result;
});
newgameButton.addEventListener("click", function () {
// Set result to input value
var input = document.querySelector("#input-field");
var result = main(input.value);
// Display result in output element
var output = document.querySelector("#output-div");
output.innerHTML = result;
});