How to hide elements with jQuery before they get rendered?

后端 未结 12 1322
北恋
北恋 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:18

    What I always do is create an empty div. And if some data inside that component needs to be shown, I asynchronously load data (i.e. html) into it using $.ajax().

    No need for an extra lib.

提交回复
热议问题