Cambia il tag H1 in H2 utilizzando Javascript [chiuso]
Aug 20 2020
Sto cercando un modo in Vanilla JavaScript per modificare il <h1>
tag in <h3>
tag per questo codice HTML:
<h1 class="price-heading ult-responsive cust-headformat" data-ultimate-target="#price-table-wrap-3686 .cust-headformat" data-responsive-json-new="{"font-size":"","line-height":""}" style="font-family:'Roboto';font-weight:bold;">Basic</h1>
Come posso raggiungere questo obiettivo?
Risposte
1 Dalibor Aug 20 2020 at 15:50
var el = document.getElementsByTagName('h1')[0];
var dummy = document.createElement('h2');
dummy.innerHTML = el.innerHTML;
el.parentNode.replaceChild(dummy, el);
https://jsfiddle.net/Lzg47mek/