It works if I use:
<script>
document.getElementById('download1').onclick = function() {
window.location.href="https://youtube.com";
};
</script>
But if I put it in a .js
file it doesn't work!
I could use button onclick="window.open;"
like this:
<button id="download1" class="button2">BUTTON</button>
But this should work for different files and I want to use one .js
for this, so I can change the URL
later and it would work for all files.
` tag or after your content.
– azs06 Feb 07 '17 at 22:03