SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    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

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    1. Put the contents of the div into a variable: var divcontents = thediv.firstChild.cloneNode(true)
    2. Create a form element using createElement
    3. Create a textarea, again using createElement
    4. Append divcontents to the textarea using appendChild
    5. Append the textarea to the form
    6. Insert the form before the div using container.insertBefore(theform, thediv) where container is the parent element of thediv
    7. Remove the div using removeChild


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •