Show/hide 'div' using JavaScript

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

    Just Simple Set the style attribute of ID:

    To Show the hidden div

    
    //In JavaScript
    
    document.getElementById('xyz').style.display ='block';  // to hide
    

    To hide the shown div

    ...............
    //In JavaScript document.getElementById('xyz').style.display ='none'; // to display

提交回复
热议问题