JavaScript hide/show element

前端 未结 11 1610
死守一世寂寞
死守一世寂寞 2020-11-22 00:08

How could I hide the \'Edit\'-link after I press it? and also can I hide the \"lorem ipsum\" text when I press edit?



        
11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 00:49

    You can also use this code to show/hide elements:

    document.getElementById(id).style.visibility = "hidden";
    document.getElementById(id).style.visibility = "visible";
    

    Note The difference between style.visibility and style.display is when using visibility:hidden unlike display:none, the tag is not visible, but space is allocated for it on the page. The tag is rendered, it just isn't seen on the page.

    See this link to see the differences.

提交回复
热议问题