Change element display none back to default style value JS

前端 未结 6 1011
伪装坚强ぢ
伪装坚强ぢ 2020-12-20 11:22

I have a function in JS that hides the element parsed:

function hide(id){
  document.getElementById(id).style.display = \"none\";
}

How can

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-20 12:08

    Filling in an empty value removes the inline override, so the original value is active again.

    function show(id){
        document.getElementById(id).style.display = "";
    }
    

提交回复
热议问题