How to hide elements with jQuery before they get rendered?

后端 未结 12 1306
北恋
北恋 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

    I would always use Modernizr.js http://modernizr.com/ to handle this.

    With Mondernizr a class 'js' or 'no-js' is added to the HTML tag of your page.

    From here you can hide your elements only if the html tag has the js class.

    Modernizr is great for so many other applications and worth reading up on if you've not used it before: http://modernizr.com/docs/

提交回复
热议问题