I want to make an HTML element visible based on whether or not another element on the page has a certain class:
function MyViewModel() {
var self = this;
this.showElement = ko.computed(function() {
return $('#history').hasClass('active');
}, this);
}
<li data-bind="visible: showElement">Element Text</li>
<div id="summary" class="tab-pane fade in active"></div>
<div id="history" class="tab-pane fade in"></div>
Any time a tab-pane is clicked, that tab gets the 'active' class. Depending on which tab is active, I'd like to either hide or show the li element. I feel like I'm close, but missing something.