'Make persistent changes to HTML file using JavaScript [duplicate]
The code below saves the contents of a <textarea>
to the DOM when the Save button is clicked.
function save() {
// Create the new element
const newElement = document.createElement("p");
const txt = document.createTextNode(document.getElementById("editorBox").value);
newElement.appendChild(txt);
// Add the new element to the DOM
const insertionPoint = document.getElementById("insertionPoint");
insertionPoint.appendChild(newElement);
}
However, the changes are not added to the HTML file and, therefore, are removed as soon as the page is refreshed. Is there a way to make persistent/permanent changes to the HTML file? How?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|