Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<html lang="ja">
<meta charset="utf-8" />
<script src="dom_observer.js"></script>
<input type="button" value="Hello" onclick="appendTextNode()"/>
<div id="text-container"></div>
var target;
window.onload = function() {
target = document.getElementById('text-container');
var observer = new MutationObserver(function() {
observer.observe(target, { childList: true });
var appendTextNode = function() {
let textNode = document.createTextNode('World');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment