How to make a DIV visible and invisible with JavaScript

后端 未结 7 494
长情又很酷
长情又很酷 2020-12-02 11:50

Can you do something like

function showDiv()
{
    [DIV].visible = true;
    //or something
}
相关标签:
7条回答
  • 2020-12-02 12:31

    You can use the DOM functions: setAttribute and removeAttribute. In the following link you have an example of how to use them.

    setAttribute and removeAttribute functions

    A quick view:

    hide:    document.getElementById("myDiv").setAttribute("hidden","");
    unhide:  document.getElementById("myDiv").removeAttribute("hidden");
    
    0 讨论(0)
提交回复
热议问题