I have a panel that I've created using Bootstrap. The panel contains a list of items with the item detail stored in a hidden div within the item itself.
When the list item is clicked I would like to replace the entire panel content with the content of the detail div for the clicked item.
I also need to revert back to the list view when the "Back to List" link is clicked.
Obviously, I'm going to need to create a javascript function to do this, as I assume there's nothing within Bootstrap that handles this.
What's the best way to do this?
<div class="col-md-4 col-sm-6">
<div class="panel panel-default">
<div class="panel-heading"><a href="#" class="pull-right">Back to List</a> <h4>Symmetric Keys</h4></div>
<div class="panel-body">
<div>Item 1
<div class="hidden">This is the rest of the data</div>
</div>
<div>Item 2
<div class="hidden">This is the rest of the data</div>
</div>
<div>Item 3
<div class="hidden">This is the rest of the data</div>
</div>
<div>Item 4
<div class="hidden">This is the rest of the data</div>
</div>
<div>Item 5
<div class="hidden">This is the rest of the data</div>
</div>
</div>
</div>
</div>
I've created an example here: