Skip to content
Advertisement

Tag: radio-button

How to detect when a radio input is unchecked in Javascript

I have 4 radio input separated by divs. I want to select the input, and make the card border change. But the event listener only works when it’s checked, no when it’s unchecked. Codepen version https://codepen.io/nazarenoalt/pen/dyOKqYp HTML Answer You can maintain a reference to the last selected I would just add and remove a class so you do not have

Syntax for checking value of radio button

Iḿ trying to check for a value of a radio input with Javascript, here is an if statements in one the functions in my code: I’m having trouble with the syntax of the if (understanding1.value == yes ) do … Here is what my code is suppose to do: The user inputs some text > the text has the id

How can I change the background image of an HTML id, via a radio button, using Javascript

I’m working on/struggling with some Javascript for a project. Currently I have only an index.html, which contains five sections, each with their own id, and each with a different background-image allocated to these sections. I have a button in the footer, which when clicked, should change each of these section background-images to a different image. The current background-image for #landingImage

Advertisement