Reputation: 465
I'm trying to change the panel title when a button is clicked.
I've tried to assign an id to the panel-title but it seems a wrong approach
<div class="panel-heading">
<h4 id="something" class="panel-title">Engagement Indicators Average</h4>
</div>
document.getElementById('something').innerHTML = 'New title';
Upvotes: 0
Views: 295
Reputation: 115
document.getElementById('btn_change').addEventListener('click', function() {
document.getElementById('something').innerHTML = 'New title';
});
<div class="panel-heading">
<h4 id="something" class="panel-title">Engagement Indicators Average</h4>
</div>
<button id="btn_change">
Change my title
</button>
Use the snippet above as a guide. It works.
Upvotes: 1