问题
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