Is there a way to remove the dom element from the document, but save it as a variable? I assume that I need to save the clone as var and then delete the original?
In addition, whether such a style will store styles, etc.
Yes, this is what you do.
var savedElement = document.getElementById('element_that_you_want_to_save'); savedElement.parentNode.removeChild(savedElement); // savedElement will still contain the reference to the object, // so for example, you can do: savedElement.style.height = '100px'; document.getElementById('container').appendChild(savedElement); // etc.
Source: https://habr.com/ru/post/1308440/More articles:Removing Drupal javascript from Full HTML Link - javascriptprogram for printing odd numbers and even numbers in separate streams - cCompactness of a given array task - arraysPage CSS style, but where to put the code? - cssPositional Delimiters - jquerycalling Greasemonkey functions from a web page - greasemonkeyDetermine if a string is a newline in C # - c #Initialize modules in apache2 - initializationPartial class or "chain inheritance" - c #How to use Pisa in Google App Engine to create PDF from HTML / CSS - google-app-engineAll Articles