p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 (http://p2p.wrox.com/forumdisplay.php?f=310)
-   -   Radio controls and getElementById (http://p2p.wrox.com/showthread.php?t=65763)

roccosiffredi February 7th, 2008 07:17 PM

Radio controls and getElementById
 
Good morning, I'm trying the getElementById function in a document, but I have a problem with radio controls.
I'd like to get the radio control selected, but it always return me the first radio button and then the value London.
What's the right syntax?

Thanks in advance

My HTML is
<input type="radio" name="city" id="city" value="London">London
<input type="radio" name="city" id="city" value="Madrid">Madrid
<input type="radio" name="city" id="city" value="Milan" checked>Milan


and my Javascript
var city = document.getElementById("city");
alert(city.value);




All times are GMT -4. The time now is 03:04 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.