http://code.google.com/p/jquery-clean/

Clean

Trim

Example

$.htmlClean("<H1 class=\"header\"><P>Nested P Test</H1>", { format: true })

Example

<p> Recently this site has changed structure, it's still being updated and pages are not where they used to be. My SEO friend tells me that I need to keep a track on the changes and nicely redirect requests to the new location. </p>