I have a basic template file of which I want to update data and then "save it" as a brand new separate html file.
Is it possible to do with Vanilla JavaScript?
Here is my example code:
window.onload = (event) => {
function updateData(newData) {
const toUpdate = document.getElementsByClassName('toUpdate')[0];
toUpdate.innerText = 'Updated!'
}
updateData('Updated!')
};
// How can I save this html as a separate new html file with vanilla Javascript?
<!DOCTYPE html>
<html>
<head>
<title>Document</title>
</head>
<body>
<h1 class="toUpdate">Not updted</h1>
</body>
</html>
<!-- How can I save this html as a separate new html file with vanilla Javascript? -->
Is it possible to achieve this with Vanilla JavaScript?