Skip to content

Instantly share code, notes, and snippets.

Created Jan 11, 2016
What would you like to do?
<div field='field_name'>
<span class='editable' data-field='field_name'>bar</span>
$(document).on('click', 'span.editable', function () {
var data = $(this).html()
var field = $(this).data('field')
$('div[field="'+field+'"]').html("<input class='form-control quickie' type='text' data-field='"+field+"' value='" + data + "'>")
$(document).on('focusout', 'input.quickie', function (event) {
var data = $(;
var field = $('field')
$('div[field="'+field+'"]').html("<span class='editable' data-field='"+field+"'>"+data+"</span>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment