1

I recently added this function to my .js file for my website:

function toggleActive() {

    $("#terminalLabel").addClass("active");

}

for:

<input id='terminal' class='hidden' type='checkbox' placeholder='Terminal Option' name='terminal[0][]'>
<label id='terminalLabel' class='btn btn-default' for='terminal2' onclick="toggleActive()">Terminal Option</label>

I kept getting an uncaught reference error when I would try to activate the function, but didn't know why.

I put the function in script tags to see if it worked, and it did. I added a different function to the button that was already defined in the same .js file that I made this new function, and that function worked.

Then I changed the name of the file from form.js to form1.js and had my site call it up, and then the function just worked. Why is this?

1 Answers1

0

In google chrome press f12 then the settings icon (locks like a gear) and under general check the option disable cache (you need to have the dev options open for this to be active) then rightclick the refresh icon and click clear cache, and what you can also do is just ?_=1 on the end of your url and it will read is at a new version and increment the number when you make changes.

Patrik Fröhler
  • 1,221
  • 1
  • 11
  • 38