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.
Auf dieser Seite können Sie das Online-Video HTML CSS JavaScript Demo: Radio Buttons -- Version 2 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Thomas Blum 14 Januar 2022 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 75 Mal angesehen und es wurde von 0 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!