javascripthtmlexternal-script

Why is my external script not included and how to change inner HTML


I am working on a basic website and I'm trying to use JS to make "video-navigator"

The thing is:

So this is my HTML for including my JS

<script src="script.js"></script>

Click here for the entire site


Solution

  • You have a few issues with this. Firstly you're trying to set the innerHTML incorrectly which is failing. Secondly you're using a reserved word for a function (new). In the pop function I've commented out your incorrect bit and added a correct version. I've also renamed your function to new_renamed so that it works.

    alert("working");
    function pop()
    {
        alert("INVALID INPUT");
        //HTMLDivElement("content") innerHTML = "";
        document.getElementById('content').innerHTML = '';
    }
    function old()
    {
        alert("INVALID INPUT");
    }
    function new_renamed()
    {
        alert("INVALID INPUT");
    }
    

    Above will log.