Basic JavaScript Question:
Download Questions PDF

How to find the selected radio button immediately using the 'this' variable?


function favAnimal(button) {
alert('You like '+button.value+'s.');
<input type="radio" name="marsupial" value="kangaroo"
<br /><input type="radio" name="marsupial" value="Opossum"
<br /><input type="radio" name="marsupial" value="Tasmanian Tiger"
onchange="favAnimal(this)">Tasmanian Tiger

Download JavaScript Interview Questions And Answers PDF

Previous QuestionNext Question
What is === operator? How to find radio button selection when a form is submitted?