Another IE Bug. Why Microsoft, Why?
I installed the WordPress plug-in 'Democracy' today and got a call from a user telling me that he couldn't add an option to the poll. After checking the user, I found out that there was a problem with Internet Explorer. Big surprise, right?
I learned that when creating a radio button html item using Javascript's `createElement()` function, unless very carefully crafted, Internet Explorer will refuse to select the radio button. The following Javascript code fails miserably in IE 6 & 7:
var rdo = document.createElement('input');
rdo.type = 'radio';
rdo.id = 'someUniqueID';
rdo.name = 'myRadio';
rdo.value = 1;
myDocumentsBody.appendChild(rdo);
The way around it? Simply create the entire element using innerHTML.
document.getElementById("my_id").innerHTML('<input type="radio" id="someUniqueID" name="myRadio" value="1" />');
This works in all major browsers and IE will actually be able to select the radio button.
I freaking HATE IE. This is yet another example of how Microsoft has failed the web developer community by not providing consistent standards for us to adhere to.


