Firstly, im very noob at jQuery, it is the first time that i try to use it.
I've this code in php
echo "<table><tr onclick=\" myFunction($id) \" style=\"$style\" id =\"set_\" ><td>Click</td></tr></table>";
I wanted that if i click to this tr, the myFuction function will start and the code of this function:
function myFunction(id) {
var id = "set_";
if (document.getElementById(id.concat(id)).style.display === "block") {
document.getElementById(id.concat(id)).style.display = "none";
x++;
} else {
document.getElementById(id.concat(id)).style.alignItems = "center";
document.getElementById(id.concat(id)).style.display = "block";
x--;
}
if (x == 0) {
document.getElementById("table").style.visibility = "hidden";
} else {
document.getElementById("table").style.visibility = "visible";
}
}
And it shows in here:
for ($x = 0; $x < $i; $x++) {
echo "<tr>";
echo "<td id='set_$id' style='display: none'>";
echo $result_path[$x];
echo "</td>";
echo "</tr>";
}
So normally i've more than one td for some of them, but myFunction just show 1 of them. I see that i can show it via jQuery and i tried it like :
$(document).click(myFunction(req_id){
var id = "set_";
var id2 = id+req_id;
$("$id2").show();
});
For now i just tried the show but i couldnt, could you please help me? Thanks.