Skip to content

Instantly share code, notes, and snippets.

@ericpkatz
Created April 30, 2021 19:54
Show Gist options
  • Save ericpkatz/c3b106149a53c7033e68e0cb3e5ca0f3 to your computer and use it in GitHub Desktop.
Save ericpkatz/c3b106149a53c7033e68e0cb3e5ca0f3 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
body {
color: red;
}
</style>
</head>
<body>
<h1>Hello World</h1>
<ul>
</ul>
<script id="jsbin-javascript">
const ul = document.querySelector('ul');
document.querySelector('h1').addEventListener('click', (ev)=> {
const rnd = Math.random();
ev.target.innerText = rnd
const el = document.createElement('li');
el.innerText = rnd;
ul.append(el);
})
</script>
<script id="jsbin-source-javascript" type="text/javascript">const ul = document.querySelector('ul');
document.querySelector('h1').addEventListener('click', (ev)=> {
const rnd = Math.random();
ev.target.innerText = rnd
const el = document.createElement('li');
el.innerText = rnd;
ul.append(el);
})</script></body>
</html>
body {
color: red;
}
const ul = document.querySelector('ul');
document.querySelector('h1').addEventListener('click', (ev)=> {
const rnd = Math.random();
ev.target.innerText = rnd
const el = document.createElement('li');
el.innerText = rnd;
ul.append(el);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment