|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
how to see if radiobutton is checked?
Hi,
I have several radiobuttons named reporttype but only one of them is checked and so I wonder if there's any way to detect which one it is or get the value of the one that is. Sure, I can do this.... if (document.myform.reporttype[0].checked = true) result = document.myform.reporttype[0].value; ...but isn't there a cleverer way than iterating each radiobutton named reporttype? Hope to hear from you soon, Dracuella |
|
#2
|
||||
|
||||
|
Use a for loop: http://www.google.com/search?num=20...+button&spell=1
Not sure what else you are expecting to do? |
|
#3
|
|||
|
|||
|
Well, I was hoping it had some sort of getWhichRadiobuttonOfNameXXThatIsChecked()
but okay it IS only javascript ![]() sorry for botherting you guys, -Drac |
|
#4
|
||||
|
||||
|
You can give all your buttons unique id's, and use getElementById() to see if a button is checked, but unfortunately there isn't any function that can immediately return the index of the selected button. That's a good idea though.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > how to see if radiobutton is checked? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|