if you just trying to hide element by id you can use onclick
<button onclick="this.style.display = 'none'">Hide Me</button>
or you can pass the id to javascript function
<button id="detail_<?php echo $row['id'] ?>" onclick="hideElement(this.id)">Hide Me</button>
<script>
function hideElement(id){
document.getElementById(id).style.visibility = "visible";
}
</script>
i’m confused on how to write this correctly
so the ID is distinquished by numbers. example in html:
id ="detail_$row["id"]"
this is what i’m trying to get in my script
document.getElementById("detail_<?php echo $row["id"] ?>").style.visibility = "visible";
it supposed to work like modal images, so when i click the parent element, this child element shows up, and while it is in a loop, i need to find a way to input the array into javascript getElementById. I have also tried using php echo and json_encode in myscript but doesn’t work still..