In this video we take a second look at an HTML web page with a set of radio buttons (inputs of type radio). One change from the previous version is that we placed the JavaScript into a separate file that we connect to at the bottom of the HTML page with a script tag. We used addEventListener to connect code to the click events of the button and the radio buttons. We looped over the radio-button options using the forEach method connected to arrays. Instead of looping over radio buttons and asking which one was checked, we use the document.querySelector approach and looked for something in the checked state. input[name="radSize"]:checked We put that in a try-catch block in case the user had not selected a size.
Sur cette page du site, vous pouvez voir la vidéo en ligne HTML CSS JavaScript Demo: Radio Buttons -- Version 2 durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Thomas Blum 14 janvier 2022, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 75 fois et il a aimé 0 téléspectateurs. Bon visionnage!