+ 2
How to change + icon to - icon when span is clicked?
2 Respostas
+ 3
const span=document.getElementsByTagName("span");
for(let i=0; i<span.length; i++){
span[i].onclick=function (){
const content=document.querySelectorAll(".content");
for(let j=0; j<content.length; j++){
if(j===i)
content[j].classList.toggle("show")
else
content[j].classList.add("show")
}
}
}
// in addition will be needed to set the start positions of the spans for example using css
+ 1
JaScript thanks but my problem is the - icon
I want + icon be replaced with -icon while toggling spans