Skip to content

Instantly share code, notes, and snippets.

@JHarry444
Created June 16, 2020 10:30
Show Gist options
  • Save JHarry444/773b00c6c599bb081c3bc9eabb2da287 to your computer and use it in GitHub Desktop.
Save JHarry444/773b00c6c599bb081c3bc9eabb2da287 to your computer and use it in GitHub Desktop.
<html>
<head>
</head>
<body>
<h1>Create Element</h1>
<input id='text' />
<button id="createButton">Create</button>
<div id='output'>
</div>
<script src="../js/create.js"></script>
</body>
</html>
(function () {
document.getElementById('createButton').addEventListener('click', function () {
const newParagraph = document.createElement('p');
newParagraph.innerText = document.getElementById('text').value;
document.getElementById('output').appendChild(newParagraph);
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment