SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Jul 17, 2007, 10:01 #1
- Join Date
- May 2006
- Posts
- 118
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Changing from a DIV to a form with textarea?
Hey,
How could I have a DIV with some content change to a textarea in a form that has the same content in the DIV?
Thanks,
Tom
-
Jul 17, 2007, 13:52 #2
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
- Put the contents of the div into a variable: var divcontents = thediv.firstChild.cloneNode(true)
- Create a form element using createElement
- Create a textarea, again using createElement
- Append divcontents to the textarea using appendChild
- Append the textarea to the form
- Insert the form before the div using container.insertBefore(theform, thediv) where container is the parent element of thediv
- Remove the div using removeChild
Bookmarks