-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.js
More file actions
38 lines (29 loc) · 1.12 KB
/
Copy pathcheck.js
File metadata and controls
38 lines (29 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
34
35
36
37
38
// .checked = property that determines the checked state of an
// HTML checkbox or radio button element
const myCheckBox = document.getElementById("myCheckBox");
const visaBtn = document.getElementById("visaBtn");
const masterCardBtn = document.getElementById("masterCardBtn");
const payPalBtn = document.getElementById("payPalBtn");
const mySubmit = document.getElementById("mySubmit");
const subResult = document.getElementById("subResult");
const paymentResult = document.getElementById("paymentResult");
mySubmit.onclick = function() {
if(myCheckBox.checked) { //gives true value
subResult.textContent = 'You are subscribed!';
}
else {
subResult.textContent = 'You are NOT subscribed!';
}
if(visaBtn.checked){
paymentResult.textContent = 'You are paying with Visa';
}
else if(masterCardBtn.checked){
paymentResult.textContent = 'You are paying with MasterCard';
}
else if(payPalBtn.checked){
paymentResult.textContent = 'You are paying with PayPal';
}
else {
paymentResult.textContent = 'You must select a payment type';
}
}