Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding innerHTML containing form
Message
From
20/10/2017 03:41:56
 
 
To
19/10/2017 17:45:38
General information
Forum:
Javascript
Category:
DHTML
Miscellaneous
Thread ID:
01655077
Message ID:
01655093
Views:
34
>>Probably better to use .insertAdjacentHTML() : https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML
>.
>.insertAdjacentHTML() inserts the HTML with afterbegin inside the div I wish to replace the innerHTML with. So, at first, I clear it. Then, I replace it.
>
>
>loDiv=parent.document.getElementById("IFrameContainer")
>loDiv.innerHTML=''
>loDiv.insertAdjacentHTML('afterbegin',document.body.innerHTML)
>
>
>This makes the page to look ok. However, the content of the form is not parsed as complete HTML tags. Thus, when posting, only the form values in their initial state is posted. What I change in the form is ignored.
>
>beforeend inserts the HTML at the same place. Because I clear the div innerHTML at first, beforeend would result in the same as the first approach.
>
>beforebegin inserts the HTML but breaks my page. Nothing is even posted to the server.
>
>afterend inserts the HTML at the end of the page. Nothing is even posted to the server.

Can you post a simple repro ?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform