[SOLVED] form alteration through firefox DOM

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
tores
Forum Contributor
Posts: 120
Joined: Fri Jun 18, 2004 3:04 am

[SOLVED] form alteration through firefox DOM

Post 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);
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Please mark the topic to [SOLVED] if you have 'Found a solution'.
Post Reply