Skip to content

Instantly share code, notes, and snippets.

@tjstalcup
Last active April 1, 2016 02:27
Show Gist options
  • Save tjstalcup/ae720b5634388a5b32ed42a6e2807fa3 to your computer and use it in GitHub Desktop.
Save tjstalcup/ae720b5634388a5b32ed42a6e2807fa3 to your computer and use it in GitHub Desktop.
$(document).on('click', '.fa-edit', function () {
var $el = $(this).parent().parent().parent().parent().children('.left');
var value = $el.text();
$el.html('<input type="text" id="edit" value="'+value+'"/>');
$('#edit').focus();
});
$(document).on('keyup', '#edit', function(e){
// enter
if(e.which==13){
var value = $(this).val();
var $el = $(this).parent();
$el.html(value);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment