469,589 Members | 2,271 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,589 developers. It's quick & easy.

Radio buttons not getting selected

Hi everyone!
I'm using the DOM standard to create a set of radio buttons, but I can't select any of them. It means that they appear in the page, but when I click on any of them nothing seems to happen. This is the code I've written to create the radio buttons

var list = document.createElement("table");
var tbody = document.createElement("tbody");
var values = new Array("Hoy","Ayer","Ultima semana","Este mes","Personalizar");

for(var i=0; i<values.length; i++)
var tr = document.createElement("tr");
var td = document.createElement("td");
var option = document.createElement("input");





return list;

So if any of you sees that something is missing, say an attribute or something like that to make it work, please help me out and reply this.
Thanks a lot

Dec 5 '06 #1
3 1588
4,258 Expert 4TB
You created the buttons and put them on the screen, but where is the code that captures the button when clicked?

Ronald :cool:
Dec 5 '06 #2
1,892 Expert 1GB
If you want to default to one you need to add checked="checked"
Dec 5 '06 #3
You created the buttons and put them on the screen, but where is the code that captures the button when clicked?

Ronald :cool:
You're right, I haven't written that code, but it's just because I thought that it would be like in the case of the select element in which one you don't have to select the options by yourself, you just attach a function to an event when you want to do something in particular when it fires.
Anyway, now I have another question, I could do this
option.onclick = anyFunction;

But then I would be calling a function with no parameters, so how would I know which was the radio that was clicked? Or how could I attach a function dynamically which I could pass the clicked radio name or id to?

Thanks again.

Dec 5 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Oscar Monteiro | last post: by
6 posts views Thread by Craig Keightley | last post: by
5 posts views Thread by Digital Puer | last post: by
1 post views Thread by Rage Matrix | last post: by
3 posts views Thread by Flip | last post: by
2 posts views Thread by dpazza | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.