$(selector).load(url, function(){ // your existing load function
$(selector).find('h1').replaceWith(function() {
return '<h2>' + $(this).text() + '</h2>';
});
});
/***
Changes an HTML elements HTML tag from one type to another
@ Params:
elemSelector - the css selector of the element you want to change
tagType - the type of tag to change the element to
***/
function changeHTMLTag(elemSelector,tagType)
{
jQuery(elemSelector).replaceWith(
function()
{
return jQuery("<"+ tagType +">", {class: this.className, html: jQuery(this).html()});
}
);
}
// example usage:
changeHTMLTag('#myElement','h2'); // This will change the element into a h2 tag