I have one html file index.html
and two html templates that presentation.html
and lookup.html
.
I have my onClicks setup as such in index.html
:
<div class="sidenav">
<h4 class="sidenav-header"> Header </h4>
<hr class="style1">
<button id="presentation-button" onclick="showPresentationScreen()">Presentation Creator</button>
<hr class="style1">
<button id="lookup-button" onclick="showLookupScreen()">Lookup</button>
<hr class="style1">
<button id="manage-button" onclick="showManageScreen()">Manage</button>
</div>
<!-- Sidebar is here-->
<div id="container"> </div>
<script>
require('./assets/intro.js');
function showLookupScreen() {
require('./assets/lookup.js');
}
function showPresentationScreen() {
require('./assets/presentation.js');
}
</script>
Here is presentation.js
and lookup.js
:
var link = document.querySelector('#presentation-file');
var template = link.import.querySelector('template');
var clone = document.importNode(template.content, true);
var elem = document.querySelector('#container');
while (elem.firstChild) {
elem.removeChild(elem.firstChild);
}
elem.appendChild(clone);
var link = document.querySelector('#lookup-file');
var template = link.import.querySelector('template');
var clone = document.importNode(template.content, true);
var elem = document.querySelector('#container');
while (elem.firstChild) {
elem.removeChild(elem.firstChild);
}
elem.appendChild(clone);
When I run my Electron app, the onClick() works as expected the first time (going from presentation.html
-->lookup.html
. But when I try going back to presentation.html
, it doesn't render the page. Why isn't this working?