document.getElementById(“test”).style.display=“hidden” not working

后端 未结 11 1140
没有蜡笔的小新
没有蜡笔的小新 2021-02-02 14:10

I want to hide my form when I click on the submit button. My code is as follows:



        
11条回答
  •  無奈伤痛
    2021-02-02 14:43

    It should be either

    document.getElementById("test").style.display = "none";
    

    or

    document.getElementById("test").style.visibility = "hidden";
    

    Second option will display some blank space where the form was initially present , where as the first option doesn't

提交回复
热议问题