Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

change h2 to h1 using javascript

/*Try using this function*/
function changeHTMLTag(elemSelector,tagType)
{
	var elem = document.querySelector(elemSelector);
    elem.outerHTML = '<' + tagType + '>' + elem.innerHTML + '</'+ tagType +'>';
}
// eg usage: change #myElem to use h2 tag -->
changeHTMLTag('#myElem', 'h2');
 
PREVIOUS NEXT
Tagged: #change #javascript
ADD COMMENT
Topic
Name
5+4 =