I want to replace a HTML tag with another, when loading a page, without showing original tag. For example I have a tag with class named header.
<h2 class="header">Original Tag</h2>
and I want to replace with another tag without showing original tag, for example :
<div id="new-header" class="new-header">New Tag</div>
I use of this code:
<script>
$(document).ready(function() {
var orgHeader = $(".header");
orgHeader.replaceWith($("#new-header").html());
});
</script>
<div id="newheader" class="header">
<h3>I'm new.</h3>
</div>
But, at first show the original tag and then remove it, and show new tag.