Пример:
При нажатии по параграфу, html конвертируется в текст.
"HTML"
<b>Click</b> to change the <span id="tag">html</span>
to a <span id="text">text</span> node.
This <button name="nada">button</button> does nothing.
"CSS"
p { margin:8px; font-size:20px; color:blue;
cursor:pointer; }
b { text-decoration:underline; }
button { cursor:pointer; }
"Живой пример jQuery"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link href="http://slyweb.ru/css/jqueryiframe.css"
rel="stylesheet" type="text/css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").click(function () {
var htmlStr = $(this).html();
$(this).text(htmlStr);
});
});
</script>
</head>
<body class="iframe">
<b>Click</b> to change the <span id="tag">html</span>
to a <span id="text">text</span> node.
This <button name="nada">button</button> does nothing.
</body>
</html>
<style>
p { margin:8px; font-size:20px; color:blue;
cursor:pointer; }
b { text-decoration:underline; }
button { cursor:pointer; }
</style>