简体   繁体   中英

CSS attribute to backbone el view

Is it possible in backbone to add an empty attribute such as data-equalizer:

<div class="row" data-equalizer>

My backbone view looks like this:

MyApp.Views.UserPanelInnerContainerView = Support.CompositeView.extend({

className: "row",
initialize: function(){
},
render: function(){
}
});

I can add class of row using className, but how do i add data-equalizer?

I got the answer:

className: "userPanelInnerContainerView",
attributes: {
    "data-equalizer": ""
},

Reference: http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#boolean-attributes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM