Skip to content

Instantly share code, notes, and snippets.

@elin3t
Forked from anonymous/jsbin.ijexak.html
Created April 22, 2014 16:17
Show Gist options
  • Save elin3t/11185272 to your computer and use it in GitHub Desktop.
Save elin3t/11185272 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div>
Name:
<span id="display">Jsbin</span>
<input type="text" id="edit" style="display:none" />
</div>
</body>
</html>
$("#display").click(function(){
$(this).hide();
$(this).siblings("#edit").show().val($(this).text()).focus();
});
$("#edit").focusout(function(){
$(this).hide(); $(this).siblings("#display").show().text($(this).val());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment