Show/hide 'div' using JavaScript

前端 未结 14 999
伪装坚强ぢ
伪装坚强ぢ 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:40

    Using style:

    
    

    Using an event handler in JavaScript is better than the onclick="" attribute in HTML:

    
    
    
    
    div1
    div2

    JavaScript:

    
    

    jQuery may help you to manipulate DOM elements easy!

提交回复
热议问题