I'm working on a project in PHP and a little bit of JQuery. Im trying to get patients from a database, present them as a table, and then as you hover over on of the rows of the table, it will pop up with a new window showing the patient's health record. Something like that:
I give every row in the table an id dynamically since I dont know how many rows I am going to have, like that:
echo "<tr id=\"patient" .$count. "\" class=\"trying\">
and I increment i by one in every iteration. However, when I try to use the JQuery, I'm having a problem with accessing each id. I tried to do this:
var count = div.textContent;
for(var i=0;i<count;i++){
//alert(i);
$("#patient"+i).mouseover(function() {
$("#des" +i).show();
}).mouseout(function() {
$("#des" +i).hide();
});
}
But even though the loop does run, it just doesn't work (Im guessing because of scope issues). Any ideas or recommendation on what I can do to solve this problem? Thanks a lot