document.getElementById('test').innerHTML = '<h1>Hello World</h1>';
Is there anyway that I can remove everything the code above put between two HTML tags?
document.getElementById('test').innerHTML = '<h1>Hello World</h1>';
Is there anyway that I can remove everything the code above put between two HTML tags?
I gather you want to remove the text between the <h1>
and the </h1>
. Simple:
const test = document.getElementById('test');
const child = test.firstChild;
child.innerHTML = "";