Skip to content

Instantly share code, notes, and snippets.

@Hampei
Created November 23, 2013 22:29
Show Gist options
  • Save Hampei/7620825 to your computer and use it in GitHub Desktop.
Save Hampei/7620825 to your computer and use it in GitHub Desktop.
// keeps the value of formfield set to html contents below target
window.sync_node_html_to_form_field = function(node, field) {
var observer = new MutationObserver(function(mutations) {
field.value = node.innerHTML;
});
observer.observe(node, { characterData: true, childList: true, subtree: true });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment