Get HTML inside div?
I know I can use the .innerHTML to get the value of a div.
However, say this has a on it, with entered data. The value="" doesn't get updated (not that it really would, or should)...
But is there anyway I can get the innerHTML including the updating input values rather than the default?
SonicMailer Pro - Professional mailing list manager & award-winning email marketing software
Download a FREE 30-day trial today!
Use coupon savemoreon4 and save 10%!
Abhishek Reddy posted this at 07:30 — 12th November 2006.
He has: 3,348 posts
Joined: Jul 2001
Well, the Node object for the div is like the root node of a tree representing its contents. You can traverse it using each Node's childNodes property. The value property of the input element will be up-to-date. You can copy this tree into a new DocumentFragment for portability. If you want something analogous to innerHTML, you could serialize the tree.
What are you trying to do? Do you need the tree in serialized form? DocumentFragment should be enough for most 'internal use' situations.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.