Click to See Complete Forum and Search --> : createElement Questions


SniperX
07-19-2004, 07:47 AM
Hi there,

I would like to add a text label - but still have it associated to the input type...
i.e.
var myElement = document.createElement('input');
myNewElement.type = "radio";
myElement.setAttribute("text","bla"); //*
but i dont know what the exact label should be - to have the "label" of "bla" assocated to that input element.

All help will be appreciated

Thanks

mdw...

gil davis
07-19-2004, 07:13 PM
You create a text node and either append it to the form element or make it a sibling. It is simpler thatn you would like it to be. When you create an element, it is just like specifying the HTML tag. There is no label property on a radio button, so the DOM doesn't give you one. It is simply text in the body that appears next to the button.