Thursday 21 June 2018

javascript - click on element with same class

I know it might sound stupid but for some reason I`m having some weird problem.




so, I have a code in js which generate a table with a buttons I gave all buttons same class.



when I try to click on them and use jquery function to console.log something nothing happens.



$.each(data,function(i, d){
$('#myTable tbody').append(`

${d.Date}
${d.Name}

${d.Score}

`);
});


its inside ajax and the table generates good and each button gets class and data good.



now when I try to do




$(".graphXY").click(function(){
console.log("hit");
})


basically nothing happens and for some reason I cant find the reason.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...