简体   繁体   中英

Why am I getting as TS(1005) error on a line of code (below)?

progress-bar2 = document.getElementById("progressbarfull");

I am fairly new to coding and the error is to do with the '=' symbol but I'm not sure why..

I have changed the name of the class to something with out the hyphen and it is not that and I'm using progress-bar2 in my HTML and CSS I am also using other = document.getElementbyID/getElementbyClassName

I hope this make sense and if someone could help I'd really appreciate it.

JS variables are different from CSS classes (you can use any name you desire in JS, no matter what you decide to use in your CSS).

JS variables may include only letters, numbers, and underscores.

JS variables can't start with a number.


Chose another name for your variable, progressBar2 , which is a valid equivalent for your CSS class name.

var progressBar2 = document.getElementById("progressbarfull");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM