Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Query: JS Variables Re: Query: JS Variables

#143470
deldalton
Participant

Okay, so I’ve opted for solution “3”. I felt that it would be tidier. So, I now have the following code at the top of my JS script:

var nav;
var button;

function updateVar() {
nav = document.getElementById(“navBar”);
button = document.getElementById(“navButton”);
}

And, I have added this to my HTML document:

Now it works.

Thanks! … :)