how to revert back to normal after display:none for table row

前端 未结 9 1036
迷失自我
迷失自我 2020-12-11 14:42

Basically, I have a table. Onload, I set each row of the table to display:none since I have a lot of javascript processing to be done and I don\'t want user to

9条回答
  •  误落风尘
    2020-12-11 15:14

    Maybe it's not applicable everywhere but...
    Use a parent element (e.g.

    or something) with desired display and set display to inherit on show. like so:

    function toggleDisplay(){
      $('#targetElement').toggleClass('hide');
      $('#targetElement').toggleClass('show');
    }
    #targetElement{
      width:100px;
      height:100px;
      background-color:red;
    }
    
    .hide{
      display:none;
    }
    
    .show{
      display:inherit;
    }
    
    
    

提交回复
热议问题