View Full Version : I made a dynamic radio button, but nothing happens when I click on it!

04-04-2003, 11:15 PM

Look at this script please:

rdButt = document.createElement("input");
rdButt.type = "radio";
rdButt.name = "nothin";

I don't know what's wrong with it. I can see the radio button after running this script, but when I click on it, it doesn't get selected. I also tried to append it to a form ( I know that in NS a radio button should be inside a form or it doesn't function as you expect! ), but nothing changed.

Thanks in advance

04-05-2003, 12:21 AM
Looks like a problem with IE. Works fine for me in Mozilla 1.2 and Opera 7

Sorry, I don't know why. Maybe I'll crawl around MSDN a bit later and look.

04-05-2003, 12:29 AM

According to this page (http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/createelement.asp) the solution is as follows

rdButt = document.createElement( '<input type="radio" name="nothin" />' );

Stupid. I hope this is a bug and/or poor implementation and not the intended way of doing things, as it DOES NOT work in the other browsers.

Looks like you'll need an IE-test conditional for now :rolleyes:

04-05-2003, 11:30 AM
Thank you beetle, you are a jewel in here!

Well, I even tested that in NS7 and didn't work either. It looks stupid, yes, but thanks God that my program isn't fully dependent on it! So, I can simply forget about it for now! And it's so crappy if it can not update the elements array, think we should forget about dynamic radio buttons!