0
document.getElementById('test').innerHTML = '<h1>Hello World</h1>';

Is there anyway that I can remove everything the code above put between two HTML tags?

Nooby427
  • 83
  • 7

1 Answers1

1

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 = "";
terrymorse
  • 6,771
  • 1
  • 21
  • 27