Path: csiph.com!2.us.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder4.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: How to send dynamically generated document elements to a server side script for data saving? Date: Fri, 11 Nov 2016 16:29:27 +0100 Organization: PointedEars Software (PES) Lines: 37 Message-ID: <1767224.PIDvDuAF1L@PointedEars.de> References: <1fkka1wzfld0h$.h1uvn3rxzhzz.dlg@40tude.net> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1478878168 23571 eJwFwYEBwCAIA7CXBEqZ5wid/59gkkHjFJhE3rw3NMVCaxTetWzLo/2bOIKVZlZuNM2ho/8BJpMRgQ== (11 Nov 2016 15:29:28 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Fri, 11 Nov 2016 15:29:28 +0000 (UTC) User-Agent: KNode/4.14.2 X-NNTP-Posting-Host: eJwFwQkBwEAMAjBLfaC3ymEP/iUsYU/OczAc0PTU6uu6t+xWZvRmvbM6dwQTRDUkG7F7CT8IThAz Cancel-Lock: sha1:5I8yEwc7EjDbxotwYK/Dv3uOdSw= X-User-ID: eJwNxdERBFEEBMCUOAwvHIXJP4S9/ukwKCYdAQ8GsQt7/D2L7hROjFyrag3X3kbOjKOWnn4leVek3D/Qej9oNRad Xref: csiph.com comp.lang.javascript:31699 JJ wrote: > On Thu, 10 Nov 2016 17:45:24 -0800 (PST), justaguy wrote: >> What I intend to do: >> The page allows the user to add dynamic elements (and some of such >> elements would automatically have an image file associated with it). that >> is, it allows a user to document.createElement('span') etc. >> >> I then, have a function to map all the document elements to a FORM >> element, specifically a Textarea tag with an id and name. >> >> Problem: >> I'm getting objects, instead of objects properties. >> See below >> [object HTMLHtmlElement][object HTMLHeadElement][object >> [HTMLScriptElement] >> .... >> So, what do I need to do to make it happen? >> >> Thanks. > > That's because an element object won't become a HTML code string when the > object is converted to string. You need to use its outerHTML property if > you want its HTML code. However, this wish is probably based on a flawed approach as the attributes of the element, and its descendants and their attributes, are available as and via properties in the document tree. By contrast, serialization of element objects using the “outerHTML” property will rarely yield appropriate results, as it will yield results that you have no control over (unless you parse them again, but then why did you serialize in the first place?). -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.