0007 added[Method chaining, if statements, switch statement, checkboxes, radiobuttons]

This commit is contained in:
WickedJack99
2022-08-27 13:29:07 +02:00
parent 17a342a4ed
commit 9d7e7d0968
3 changed files with 100 additions and 5 deletions

23
js/checkBox.js Normal file
View File

@@ -0,0 +1,23 @@
document.getElementById("myButton").onclick = function () {
if (document.getElementById("myCheckBox").checked) {
console.log("Channel subscribed");
} else {
console.log("Check the checkbox to subscribe");
}
}
const visaButton = document.getElementById("visa");
const paypalButton = document.getElementById("paypal");
const masterButton = document.getElementById("master");
document.getElementById("payButton").onclick = function () {
if (visaButton.checked) {
console.log("Proceding to checkout with visa");
} else if (paypalButton.checked) {
console.log("Proceding to checkout with paypal");
} else if (masterButton.checked) {
console.log("Proceding to checkout with master");
} else {
console.log("You must select a payment-type");
}
}