How to find the selected radio button immediately using.....

Discuss, Share & Learn all Web Related Technical Queries, Interview Questions, projects, resources, programs, scripts, tutorials, websites, tools etc. in this section.

How to find the selected radio button immediately using.....

Postby sriya » Fri Sep 02, 2011 1:06 pm

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

<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
sriya
 
Posts: 1030
Joined: Fri Aug 19, 2011 3:22 pm



Return to Web Related Technical Queries/Interview Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron