Sollicitatievraag

Sollicitatiegesprek voor de functie Front End Developer

-Oakland, CA

LinkedIn

// How can I know which radio was clicked or selected? <h2>Monstrous Government Form</h2> <form id="myForm" name="myForm"> <fieldset> <legend>Do you live in an:</legend> <p><input type="radio" name="home" value="apartment" id="apartment" /> <label for="apartment">Apartment</label></p> <p><input type="radio" name="home" value="house" id="house" /> <label for="house">House</label></p> <p><input type="radio" name="home" value="mobile" id="mobile" /> <label for="mobile">Mobile Home/Trailer</label></p> <p><input type="radio" name="home" value="coop" id="coop" /> <label for="coop">Co-op</label></p> <p><input type="radio" name="home" value="none" id="none" /> <label for="none">None</label></p> </fieldset> <fieldset> <legend>Your income is:</legend> <p><input type="radio" name="inc" value="0-50K" id="0-50K" /> <label for="0-50K">$0-50,000 USD</label></p> <p><input type="radio" name="inc" value="50-100K" id="50-100K" /> <label for="50-100K">$50,000-100,000 USD</label></p> <p><input type="radio" name="inc" value="100K+" id="100K+" /> <label for="100K+">$100,000+ USD</label></p> </fieldset> <fieldset> <legend>Your status is:</legend> <p><input type="radio" name="status" value="single" id="single" /> <label for="single">single</label></p> <p><input type="radio" name="status" value="married" id="married" /> <label for="married">married</label></p> <p><input type="radio" name="status" value="partner" id="partner" /> <label for="partner">domestic partner</label></p> </fieldset> <p>This form goes on with another 97 questions....</p> <input type="submit" value="Submit" /> </form>

Antwoord

Antwoorden op sollicitatievragen

3 antwoorden

1

Attach the event listener to the form id="myForm"...

Anoniem op

0

document.querySelector('input[name="house"]:checked').value;

Anoniem op

0

you can add oncl1ck event to assign event target value to a variable for each fieldset, since there are 3 different field sets, and we want to know each of them separately.

Anoniem op

Voeg antwoorden of opmerkingen toe

Meld u aan of registreer u om hier een opmerking over te maken.