I know this may sound silly, but for some reason I had some strange problem.
So, I have code in js that generates a table with buttons, which I gave to all the buttons of the same class.
when I try to click on them and use the jquery function for console.log nothing happens.
$.each(data,function(i, d){ $('#myTable tbody').append(` <tr> <td>${d.Date}</td> <td>${d.Name}</td> <td>${d.Score}</td> <td><button class='graphXY' data=${d.id}>View</button></td> </tr>`); });
its inside ajax and the table generates good, and each button gets a class and data.
now when i try to do
$(".graphXY").click(function(){ console.log("hit"); })
in principle, nothing happens and for some reason I can not find the reason.
source share