The JavaScript checked property ( javascript tutorial 12 )

Publié le: 01 janvier 1970
sur la chaîne: Raya yt
19
3

00:00:00 intro
00:00:22 HTML checkbox
00:01:13 HTML radiobuttons
00:02:58 other HTML elements
00:03:55 CSS
00:04:39 JavaScript constants
00:06:08 .onclick property
00:06:31 .checked property
00:09:49 conclusion

// .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){
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`;
}
}


Sur cette page du site, vous pouvez voir la vidéo en ligne The JavaScript checked property ( javascript tutorial 12 ) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Raya yt 01 janvier 1970, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 19 fois et il a aimé 3 téléspectateurs. Bon visionnage!