Forum : How to find the selected radio button immediately using the 'this' variable?
Brief description  about Online courses   join in Online courses
View Balu  Prasad 's Profile

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

How to find the selected radio button immediately using the 'this' variable?
Asked by Balu Prasad | Mar 22, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Balu,
<script>
function favAnimal(button) {
alert('You like '+button.value+'s.');
}
</script>
<input type="radio" name="marsupial" value="kangaroo"
onchange="favAnimal(this)">Kangaroo
<br /><input type="radio" name="marsupial" value="Opossum"
onchange="favAnimal(this)">Opossum
<br /><input type="radio" name="marsupial" value="Tasmanian Tiger"
onchange="favAnimal(this)">Tasmanian Tiger

Mar 22, 2010