Page 1 of 1

Add/Remove <span> tag

Posted: Thu Oct 20, 2005 6:49 am
by JayBird
I have a form where users can click a button and more form fields are added by using innerHTML.

I would now like to include a "remove" button incase the user adds too many fields.

I can't remove the fields by referencing them by name, as they all have the same name (date[])


So, i am thinking of wrapping each field in a <span> tag with a unique ID.

Im a little unsure how to go about removing the <span> tag and its contents using Javascript.



Thanks

Mark

Posted: Thu Oct 20, 2005 7:56 am
by feyd
it'd be a removeChild() type action..

Posted: Fri Oct 21, 2005 2:10 am
by n00b Saibot
don't use span... instead you can remove individual form elemnts by removeChild()