Currently, I am working on a sidebar that can collapse and expand when a button is clicked.
If you wish to take a look, I have created a JSFiddle for reference: https://jsfiddle.net/4er26xwp/1/
The challenge I am facing lies here:
document.getElementsByClassName("spanclass").setAttribute("style","opacity:0; -moz-opacity:0; filter:alpha(opacity=0)");
My goal is to adjust the opacity of all spanClasses
simultaneously upon clicking the button. The intention is to make the spans visible when the sidebar expands and hidden when it collapses. What could be causing the issue?
UPDATE: I discovered that by executing the following line of code: document
.getElementsByClassName("spanclass")[1].setAttribute("style","opacity:1; -moz-opacity:1; filter:alpha(opacity=100)");
it successfully changed the opacity for one of the spans. However, I am now wondering how I can achieve the same effect for all spans at once.