更新modal动态backbone.js的css

时间:2015-11-06 23:41:55

标签: javascript jquery css backbone.js

我是骨干新手,正在尝试调试问题。我有一个Modal渲染如下:

render: function() {
            this.$el.html(Modal.TEMPLATE);
            this.$(Modal.HEADER_TITLE_SELECTOR).html("Edit"));
            this.$(Modal.BODY_SELECTOR).append(this.myView.render().el);
            this.$(Modal.FOOTER_SELECTOR).append(Modal.BUTTON_DONE);
        },

'myView'与我想要覆盖的类(带有display:block)相关联(display:inline-block)。我怎么能这样做?

2 个答案:

答案 0 :(得分:1)

render: function() {
            this.$el.html(Modal.TEMPLATE);
            this.$(Modal.HEADER_TITLE_SELECTOR).html("Edit"));
            this.$(Modal.BODY_SELECTOR).append(this.myView.render().el);
            this.myView.$el.css("display", "inline-block");
            //or this.$(this.myView.$el).css("display", "inline-block")
            this.$(Modal.FOOTER_SELECTOR).append(Modal.BUTTON_DONE);
        },

答案 1 :(得分:0)

这解决了这个问题:

$(this.myView。$ el).css({display:'inline-block'});