Skip to content

Instantly share code, notes, and snippets.

@bl4de
Created October 31, 2018 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bl4de/c832954f5f2267f459e9653dcf1f2447 to your computer and use it in GitHub Desktop.
Save bl4de/c832954f5f2267f459e9653dcf1f2447 to your computer and use it in GitHub Desktop.
A simple website with dynamically added P element
<html>
<head>
<title>Dynamic P Application</title>
<style>
* {
font-size:18px;
font-weight:bold;
color: #2e2e2e;
}
</style>
</head>
<body>
<div id="container">
</div>
<script>
const el = document.getElementById('container')
const dynamic_paragraph = document.createElement('p')
const dp_content = document.createTextNode('Hello from dynamically added <P>aragraph!')
dynamic_paragraph.appendChild(dp_content)
el.appendChild(dynamic_paragraph)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment