<!doctype html>
<html>
<head>
<script src="js/jquery/1.11.3/jquery.min.js"></script>
</head>
<body>
<p>
<b>Click</b> here to view the <span id="tag">html</span> code
</p>
<script>
$("p").click(function() {
var htmlCode = $( this ).html();
$( this ).text( htmlCode );
});
/*
run:
<B>Click</B> here to view the <SPAN id=tag>html</SPAN> code
*/
</script></body>
</html>