Add button to load more blurbs
This commit is contained in:
parent
a1a06c23a2
commit
308cff3e34
@ -1,8 +1,11 @@
|
|||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
<br />
|
||||||
|
<button id="loadButton">Load More</button>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const app = document.getElementById('app');
|
const app = document.getElementById('app');
|
||||||
|
const loadButton = document.getElementById('loadButton');
|
||||||
function addElem(element, contents, attrs = {}) {
|
function addElem(element, contents, attrs = {}) {
|
||||||
const newElem = document.createElement(element);
|
const newElem = document.createElement(element);
|
||||||
newElem.appendChild(document.createTextNode(contents));
|
newElem.appendChild(document.createTextNode(contents));
|
||||||
@ -11,9 +14,13 @@
|
|||||||
}
|
}
|
||||||
app.appendChild(newElem);
|
app.appendChild(newElem);
|
||||||
}
|
}
|
||||||
addElem('h1', 'Fart man comes to town!');
|
function addBlurb() {
|
||||||
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('h1', 'Fart Man comes to town!');
|
||||||
addElem('a', 'Read more...', {href: "#"});
|
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 believe the imminent winds of change will revitalize the towns central business district.');
|
||||||
|
addElem('a', 'Read more...', {href: "#"});
|
||||||
|
}
|
||||||
|
addBlurb();
|
||||||
|
loadButton.addEventListener("click", addBlurb);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user