Recently, I made the decision to improve the look of an online manual I have been working on for my company by incorporating Bootstrap. The manual is structured with a tree-view that contains titles linking to HTML files with information and CSS stylesheets. Initially, I loaded this content into an iframe, but found it problematic when applying CSS. Therefore, I have shifted to using DIVs instead.
The question at hand:
Is there a way to load multiple HTML files into a single DIV by clicking on each title?
All titles are within "a" tags which previously could be targeted in the iframe, but now poses challenges with DIVs.
I have experimented with JavaScript and JQuery, managing to create functions to load specific HTML files. However, attempts to add parameters or use InnerHTML have resulted in issues identifying paths for these files. It is important to note that these files are locally hosted on a server.
Note: The following code snippet illustrates part of what has been attempted...
Javascript:
<script type="text/javascript">
$(document).ready(function(){
$('#content').load('intro.html')
});
</script>
HTML:
<div class="bg-light border-right" id="sidebar-wrapper">
<div class="list-group list-group-flush">
<ul id="tree3" class="list-group-item list-group-item-action bg-light">
<li><a href="PATHFILE_1">TITLE 1</a>
<ul>
<li><a href="PATHFILE_2">TITLE 2</a></li>
<li><a href="PATHFILE_3">TITLE 3</a>
</ul>
</li>
</div>
</div>
The objective is to display all the specified files within this div:
<div id="page-content-wrapper">
<div class="container-fluid">
<div id="content">
HERE THE HTML FILES WILL LOAD
</div>
</div>
</div>