The document.getElementByClassName method

how do you get the method to work when your js is inside your html file???

the method works totally fine even in that case - maybe you need to show the code you are having issues with?

say something like this

  var v = document.getElementsByClassName("Ep");
       = "66FF07";
       = "150px";

that doesn’t seem valid HTML nor JS - is that what you have written in the file?

so how can I fix it

write a correct script element and put in there correct js code

to use script element in main html is using
//your code goes here
not script {

and to use script with file.js is using <script src=“yourfile.js”></script>

ahh 1 more. document.getElementsByClassName need indexes to get the specific elements. cuz getElementsByClassName output is HTMLCollections (An array). assume there has 4 elements that have class=“myElements”. so if u want to styling the element 2 with javascript u need to use indexes to get the elements.
var v = document.getElementsByClassName(“myElements”)[1] (indexes starting in 0) = “red”; = “150px”;