I have a div with the id of \"secondHeader\" and I want to replace that entire div with another div with the same id of \"secondHeader\" but instead of replacing it , it jus
I always have a jQuery function defined like this:
jQuery.fn.loadOuter = function( url, callback )
{
var toLoad = $(this);
$.get(url, function( data ) {
toLoad.replaceWith( data );
if (callback != null && callback != undefined)
callback();
});
}
Then I can either say
$(...).load(url)
or
$(...).loadOuter(url)
The second one does what you want to do. I also have a function called loadInner which just calls load for what its worth.