Show/hide 'div' using JavaScript

前端 未结 14 834
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 04:18

For a website I\'m doing, I want to load one div, and hide another, then have two buttons that will toggle views between the div using JavaScript.

This is my

14条回答
  •  时光说笑
    2020-11-22 04:43

    And the Purescript answer, for people using Halogen:

    import CSS (display, displayNone)
    import Halogen.HTML as HH
    import Halogen.HTML.CSS as CSS
    
    render state = 
      HH.div [ CSS.style $ display displayNone ] [ HH.text "Hi there!" ]
    

    If you "inspect element", you'll see something like:

    Hi there!

    but nothing will actually display on your screen, as expected.

提交回复
热议问题