Initial VanillaJS
This commit is contained in:
commit
ec9fa157d3
19
index.html
Normal file
19
index.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<div id="app"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
const app = document.getElementById('app');
|
||||||
|
function addElem(element, contents, attrs = {}) {
|
||||||
|
const newElem = document.createElement(element);
|
||||||
|
newElem.appendChild(document.createTextNode(contents));
|
||||||
|
for(const [key, value] of Object.entries(attrs)) {
|
||||||
|
newElem.setAttribute(key, value);
|
||||||
|
}
|
||||||
|
app.appendChild(newElem);
|
||||||
|
}
|
||||||
|
addElem('h1', 'Fart man comes to town!');
|
||||||
|
addElem('p', 'Will this controversial figure finally cause the downfall of the town? Sally Smith from town center says that she can already smell trouble brewing but other members of the town beleave the imminent winds of change will revitalize the towns central business district.');
|
||||||
|
addElem('a', 'Read more...', {href: "#"});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user