I have a single HTML page with various JS imports. I'm importing JQuery, then a custom script of my own, which I'd like to use the JQuery library in, though I get a '$ is not defined' exception.
I thought as I'm loading up JQuery first, I should be able to reference it in my external script?
Is this something RequireJS would solve?
baseTemplate.html
<body>
<template id="navbar"></template>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="navbarTemplate.js"></script>
</body>
navbarTemplate.js
function isTemplateElementSupported() {
return 'content' in document.createElement('template');
}
if (isTemplateElementSupported()) {
$('#navbar').append("<table><tr><td><b>some test</b></td></tr></table>");
} else {
alert('Please update browser!');
}