Although you could wait for a button press, it’s a lot more enjoyable to grab all of your checkboxes and listen for the change event. Once the event is triggered, you can look at this.value and this.checked to see which checkbox was changed and whether it’s now checked or not.
Radio buttons are like checkboxes except you can only check one. Usually you’re going to wait for a submission, grab the selected radio button with a d3.select, then use property('value') to find the value of that one.
The radio buttons must all have the same name, that’s how the browser knows the buttons connected together.
If you want to get into the details, input[name="age"]:checked means “give me all of the inputs with the name of ‘age’, but only the ones that are checked”
Radio buttons: Listening for changes
You can also wait for them to change, and then grab the changed value.
Dropdown elements are actually two kinds of elements put together - a select that has a bunch of option elements inside. The user selects between the option tags.
Dropdowns: Getting the value
You can get the value of the select by looking at .property('value'). The value returned is not necessarily the text shown to the user - it’s what’s in the value attribute in the HTML.