How to hide multiple selectors as once with jQuery

后端 未结 2 1100
孤独总比滥情好
孤独总比滥情好 2021-02-20 10:07

How come this..

    $(\"div.toggle1\").hide();
    $(\"div.toggle3\").hide();
            $(\"div.toggle4\").hide();
            $(\"div.toggle5\").hide();
         


        
2条回答
  •  半阙折子戏
    2021-02-20 10:44

    $("div.toggle1, div.toggle3, div.toggle4, div.toggle5").hide();
    

    Or just give every DOM element that you will hide the same class and you can just do:

    $('.hideClass').hide();
    

提交回复
热议问题