在表中添加新的原始数据后,JavaScript单击功能不起作用



我正在开发一个 firestore 网络应用程序。

$("table").append(row);.

我有以下功能,它不适用于新添加的原始。(使用旧的原始文件没有任何问题(。

$(document).ready(function() {
     $("#mytable td").click(function(event) {
    alert($(this).text());
   $(this).html('y');
        }); 
 });

请您尝试以下操作。

$(document).ready(function() {
     $(document).on("click","#mytable td",function(event) {
         alert($(this).text());
         $(this).html('y');
     }); 
 });

最新更新