i have a question, can i replace html tag to another ?
But i don\'t want to make the content blank. like this:
content<
Here's a way to change the tag of an element with no jQuery -
// Just provide the element and the new tag
function changeTag(el, newTag) {
var outerHTML = el.outerHTML // Get the outerHTML of the element
var tag = el.tagName // Get the tag of the outerHTML
var r = new RegExp(tag, 'i') // Prepare a RegExp to replace the old tag with the new tag
outerHTML = outerHTML.replace(r, newTag) // Replace it
el.outerHTML = outerHTML // Set the outerHTML of the element
}
Span 1 -- Span 2