Page 1 of 1

[SOLVED] form alteration through firefox DOM

Posted: Thu Sep 01, 2005 4:26 am
by tores
Hi

Is there any way to add input elements to an existing form element in ff's DOM. Both the form element and its form.elements-property are read only, so appending to these is not possible. It doesn't seem that a forms' input elements is part of the forms' children either (they are not contained in form.childNodes).
I find it strange that a form can't be altered in this way, because when adding html dynamically through innerHTML you'd have to create a new form to accommodate any new inputs...

regards tores

edit: Found a solution

Code: Select all

form = document.getElementById('formelement');
input = document.createElement('input');
input.value = 'something';
form.appendChild(input);

Posted: Thu Sep 01, 2005 7:11 am
by n00b Saibot
Please mark the topic to [SOLVED] if you have 'Found a solution'.