Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

All comments

  • zaram 20

    @blck-zed

    Submitted

    please suggest how i the js code i can write so when i click on a detail, the next one closes

    @JessyTsiriniaina

    Posted

    You can do it by masking all the detail the show the one where the onclick event is called

    for (let index = 0; index < question.length; index++) {

    question[index].addEventListener("click", function () {
    
    
        if (reponse[index].style.display == "none") {
    
            for (let i = 0; i < reponse.length; i++) {
    
                signe[i].src = "images/icon-plus.svg";
                reponse[i].style.display = "none";
    
            }
            reponse[index].style.display = "block";
            signe[index].src = "images/icon-minus.svg";
        }
    
        else {
    
            signe[index].src = "images/icon-plus.svg";
            reponse[index].style.display = "none";
        }
    })
    

    }

    Variable: 'reponse' is the answer 'signe' represents the minus and plus sign

    1