Hello dear stack community,
I am frantically trying to change the content of a div container using JavaScript. I have already tried it via InnerHTML. As long as you only use ordinary text, the change is effective. But if I use php, which is mandatory for this, the whole page stays white and nothing happens. Here is the code:
<div class="sidenav lisa-nav" id="mySidenav" onmousemove="openNav()" onmouseout="closeNav()">
<?php Shortnav::show(); ?>
</div>
<div class="lisa-cont" id="LISACont" style="padding-left: 40px">
<script>
function openNav() {
document.getElementById("mySidenav").style.width = "200px";
document.getElementById("LISACont").style.paddingLeft = "210px";
document.getElementById("mySidenav").innerHTML= "<?php Navigation::show();?>";
}
function closeNav() {
document.getElementById("mySidenav").style.width = "30px";
document.getElementById("LISACont").style.paddingLeft = "40px";
}
</script>
The div container with the ID “mySidenav” should be changed from <?php Shortnav::show();?>
to <?php Navigation::show();?>
.
Does anyone know how to solve this as straightforward as possible?
Thank you very much for your help!