0007 added[Method chaining, if statements, switch statement, checkboxes, radiobuttons]
This commit is contained in:
23
js/checkBox.js
Normal file
23
js/checkBox.js
Normal 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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user