I am working on a Marionette application and have come across an issue with inserting new tab items. I have a collection of tabs, but when adding a new item, I need to insert DOM elements in two different areas. The problem is that Marionette.CollectionView only appends DOM at one place by default. I could override the appendHtml method, but then removing the tabs becomes more complicated. What is the best approach to enable insertion and deletion in multiple areas?
<script type='text/template' id="homeTabTemplate">
<ul class="nav nav-tabs" id="tablist">
<li><a href="#home" data-toggle="tab">Home</a></li>
<!-- #1 append li tab here -->
</ul>
<div class="tab-content" id="tabcontent">
<div class="tab-pane active" id="home">
</div>
<!-- #2 append tab-pane here -->
</div>
</script>