Edit in JSFiddle

$(document).ready(function () {
                $("#myButton").click(function () {
                    $("p").contents().filter("em").wrap("<h1>");
                });
                $("#reset").click(function () {
                    location.reload();
                });
            });
<html>
        <head>
        <title>contents</title>
        </head>
        <body>
        <p>This is <em>99codingexamples.</em> I love <em>jquery.</em></p>
        <input type="button" id="myButton" value="contents() filter by em"/>
        <input type="button" id="reset" value="Reset" />
        </body>
        </html>