Hello. I want the title on the bottom right of the site “https://yunihwang.com/” to display a description when you click on it, but it doesn’t work because the id of the div is always the same in my code. Any suggestions?
<?php snippet('header') ?>
<?php foreach ($pages->listed() as $p): ?>
<div class="slideshow">
<div class="slideshow-box">
<div class="slideshow-holder">
<?php foreach ($p->images() as $workimage): ?>
<div class="slide" id="<?= $p->classname() ?>">
<?= $workimage ?><br><br>
</div>
<?php endforeach ?>
</div>
<div class="tooltip">
<p id="myText"><?= $p->worktitle() ?></p>
</div>
<div class="toolbox" id="myDIV">
<?= $p->description() ?>
</div>
</div>
<div class="actions">
<span>1/3</span>
</div>
<a href="#" class="prev">←</a>
<a href="#" class="next">→</a>
</div>
<?php endforeach ?>
<script>
var yeseys = document.getElementById('drof');
var asd = document.getElementById('myDropdown');
asd.style.display = 'none';
yeseys.onclick = function () {
if (asd.style.display !== 'none') {
asd.style.display = 'none';
} else {
asd.style.display = 'block';
}
};
var button = document.getElementById('myText');
var div = document.getElementById('myDIV');
div.style.display = 'none';
button.onclick = function () {
if (div.style.display !== 'none') {
div.style.display = 'none';
} else {
div.style.display = 'block';
}
};
</script>
<?php snippet('footer') ?>