I’m generating the table in PHP and adding it to HTML using
I add PHP code to HTML in this way:
$('#pnametable').html(myVar);
my PHP Code:
$str="<table id='notable'>";
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
$str.="<tr id='gtpname'><td class='pnotd'>".$row['pname']."</td></tr>";
}
$str.="</table>";`
Now my jQuery code goes like this:
$("#notable > tbody > tr > td").click(function() {
alert("wdwad");
});
Please help me find solutions for it.
The data which is generated is dynamic. Try using “on” method.