How can I hide/show a div when a button is clicked?

前端 未结 8 1942
陌清茗
陌清茗 2020-12-04 22:02

I have a div that contains a register wizard, and I need hide/show this div when a button is clicked. How can I do this?

Below I show you t

8条回答
  •  借酒劲吻你
    2020-12-04 22:22

    Task can be made simple javascript without jQuery etc.

    
    

    This function is simple if statement that looks if wizard has class swMain and change class to swHide and else if it's not swMain then change to swMain. This code doesn't support multiple class attributes but in this case it is just enough.

    Now you have to make css class named swHide that has display: none

    Then add on to the button onclick="showhide()"

    So easy it is.

提交回复
热议问题