javascript - Replace html element with another element/text. Problem in the Source Code

one text

Solution:

Try to replace element

First get innerHtml from element p.

Then create a new element h1 place the content in the new element.

After this replace element p with h1

var x = document.getElementsByClassName('title_banner')[0];
var y = x.innerHTML;

var newItem = document.createElement('h1');
newItem.innerHTML = y;

x.parentNode.replaceChild(newItem, x);
<p class="title_banner"><strong>Sport</strong></p>

Source