Created
December 26, 2013 05:34
-
-
Save chikoski/8130152 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset=utf-8 /> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <input type="button" value="くりっく" id="btn"> | |
| <div id="output"> | |
| </div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.addEventListener("load", function(event){ | |
| var observer = new MutationObserver(function(record, observer){ | |
| console.log("mutated"); | |
| }); | |
| var output = document.getElementById("output"); | |
| observer.observe(output, { childList: true }); | |
| var btn = document.getElementById("btn"); | |
| var counter = 0; | |
| btn.addEventListener("click", function(event){ | |
| counter = counter + 1; | |
| var p = document.createElement("p"); | |
| p.textContent = counter; | |
| output.appendChild(p); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment