In a C# WinForms application I'm using a Web browser control in which i view some HTML designs.
I could change html element attributes through code then edit.
However, i could not clone html element to re-add them to html page again. I tried following code :
HtmlElement old_element = WebBrowser1.Document.GetElementById("element1");
HtmlElement new_element = my_element;
new_element.Style = "background-color:orange;";
my_element.Parent.InnerHtml += new_element.OuterHtml;
When running code background color is applied to both old_element
and new_element
.
I want changes to be applied only to new_element
while preserving old element as it is.
Is that possible without dealing with element html as text ?