Solution 1 :

if you just trying to hide element by id you can use onclick

<button onclick=" = 'none'">Hide Me</button>

or you can pass the id to javascript function

    <button id="detail_<?php echo $row['id'] ?>" onclick="hideElement(">Hide Me</button>
    function hideElement(id){
    document.getElementById(id).style.visibility = "visible";

Problem :

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";


Comment posted by Farhan

use single quote instead double quote like,

Comment posted by Bernardy Gosal

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..