podria ser
Código HTML:
<html>
<head>
<title>Ejemplo</title>
<script src="jquery.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
$().ready( function (){
$("#cambiar").toggle(
function () {
$('#alterna').replaceWith("<h2 id='alterna'>" + $('#alterna').text() + "</h2>");
},
function () {
$('#alterna').replaceWith("<p id='alterna'>" + $('#alterna').text() + "</p>");
}
);
});
</script>
<style type="text/css">
p{background:red}
h2{background:blue}
</style>
<body>
<div id="cambiar"><p id="alterna">el texto</p></div>
</body>
</html>
o sino
Código HTML:
<html>
<head>
<title>Ejemplo</title>
<script src="jquery.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
$().ready( function (){
$("#alterna").live('click',function (){
if ( this.nodeName == 'P' )
$(this).replaceWith("<h2 id='alterna'>" + $(this).text() + "</h2>");
else
$(this).replaceWith("<p id='alterna'>" + $(this).text() + "</p>");
});
});
</script>
<style type="text/css">
p{background:red}
h2{background:blue}
</style>
<body>
<p id="alterna">el texto</p>
</body>
</html>