Skip to content

Instantly share code, notes, and snippets.

@thedavidmeister
Last active June 11, 2016 06:47
Show Gist options
  • Save thedavidmeister/576203ddeff0082ff43389de91b1f0c2 to your computer and use it in GitHub Desktop.
Save thedavidmeister/576203ddeff0082ff43389de91b1f0c2 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script>
function clicked() {
clicked.counter = clicked.counter || 0;
clicked.counter++;
var li = document.createElement('li');
document.getElementById('foo').appendChild(li);
document.getElementById('bar').textContent = clicked.counter;
}
</script> <button onclick="clicked();">click me</button>
<div id="bar">
</div>
<ul id="foo"></ul>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment