I need to do two steps:
1)Show InputBox when clicking a div . 2)Showing the div back when mouse is out of that inputbox.
step #2 does not work.
<html>
<title>a</title>
<head>
<script type="text/javascript" src="jquery-1.8.0.js"></script>
<script type="text/javascript">
$(function() {
$('#field').click(function() {
$(this).replaceWith( "<input type=\"text\" name=\"fname\" id=\"field\" value=\"" + $(this).text() + "\">");
});
$('#field').mouseout(function() {
$(this).replaceWith( "<div id=\"field\">" + $(this).text() + "</div>");
});
});
</script>
</head>
<body>
<div id="field">hello there:)</div>
</body>
</html>
thank you:)