How do you set html / body tag attributes in Meteor.js?

后端 未结 2 632
温柔的废话
温柔的废话 2021-02-19 07:34

I need to set attributes on the html tag or alternatively the body tag of the document in a Meteor.js application.

Specifically I want to have

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-19 08:24

    You have to inject them on start-up in your client-side Javascript:

    Meteor.startup(function() {
       $('html').attr('dir', 'rtl');
    });
    

    UPDATE

    Note that you can now set attributes in-line for body tags, and they'll be concatenated by Meteor in the same way as the contents of the body tag:

    
    

    You can have multiple different body tags, and they'll get combined, so the above will just add a single attribute to your existing body, rather than replacing it.

    To the best of my knowledge, HTML tag attributes still need to be set via Javascript.

提交回复
热议问题