How to hide elements with jQuery before they get rendered?

后端 未结 12 1313
北恋
北恋 2020-12-13 08:51

I want to generate html layout with areas (divs, spans) that can be shown/hidden conditionally. These areas are hidden by default.

If I call .hide() method with jque

12条回答
  •  再見小時候
    2020-12-13 09:19

    Why not do just this?:

    // Hide HTML element ASAP
    $('html').hide();
    
    // DOM-ready function
    $(function () {
       // Do stuff with the DOM, if needed
       // ...
    
       // Show HTML element
       $('html').show();
    }
    

    It seems to work fine!

    Regards.

提交回复
热议问题