I'm looking to add the class '.expanded' to #infoBox when the user clicks on the button (which is located inside of the div), which have onclick="expand" on it.
<div id="infoBox" class="" onclick="expand">
<aside>
<h4>Kontakt</h4>
<p>Har du brug for grafisk assistance, i form af råd og vejledning, eller brug for hjælp til design af grafik? Fyr mig en besked!</p>
</aside>
<button onClick="expand" class="primaryBtn noMovement">Kontakt</button>
</div>
After searching for solutions, I see a lot of jQuery-solutions, but isn't it possible to create with plain javascript?
Out of my noobie experience, I tried the following two javascript executions, but with no luck:
function expand() {
document.getElementById("infoBox") {
classList.add("expanded");
}
}
function expand() {
document.getElementsById("infoBox").classList.add("expanded");
}