When I try to load in a collapsible it doesn't work when it is loaded in via javascript. but it does work when I hardcode it in.
I have the following code
var VeilingenZoeken = document.getElementById("VeilingenZoeken");
function getZoekResultaten() {
// console.log(rubriekenzoeken.value);
const url = "backend/veilingen/VeilingenZoekresultaat.php?q=" + VeilingenZoeken.value;
fetch(url)
.then(
response => response.text()
).then(
html => document.getElementById("veilingItems").innerHTML = html
);
}
That gets called by this html tag
<input class="center" type="text" placeholder="Veilingen zoeken..." name="VeilingenZoeken"
id="VeilingenZoeken" onkeypress="getZoekResultaten();"> <br>
It will load in the following piece of html
<div class="col s12">
<ul class="collapsible">
<li>
<div class="collapsible-header"><i class="material-icons">gavel </i> Gebruikersnaam: <span class="badge"><i class="material-icons white">info</i></a></span><a class="waves-effect waves-light btn-large" href="#">Wave</a></div>
</li>
</ul>
However, the collapsible function doesn't work when it is loaded in this way. Is there any way to force it to load?
NOTE: I think the title is a bit confusing, but I don't have any idea what else would be a suitable title for this post.