When extending a backbone view, is there a way to not render a tagname?

送分小仙女□ 提交于 2019-12-12 04:47:47

问题


I am trying to use the JQueryUI accordion script with my backbone view. In my template, i have an h3 and div tag, one for the accordion title, and one for content. Since the extended view puts a div around the each templated item, the classes that the accordion script adds are not on the correct tags.


回答1:


I believe you can just put your own placeholder on your page like this:

<div id="placeholder"/>

In your backbone view code, do NOT define el. Then define the view's el when you create the backbone view:

var search_view = new SearchView({ el: $("#placeholder") });


来源:https://stackoverflow.com/questions/9982785/when-extending-a-backbone-view-is-there-a-way-to-not-render-a-tagname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!