繁体   English   中英

使用Javascript的表格中的“删除”按钮不起作用。 我无法获取编辑按钮的值。 我有以下代码:

[英]Delete button in a table using Javascript doesn't work. I cannot get the value of the edit button. I have this code:

$(".btn-add-dependent").click(function () {
  var checked = $("#disability").is(':checked') ? "checked='checked'" : "";
  $("#dependents-info tbody").append(
     "<tr><td>" + $("#first-name").val() + "</td><td>" 
     + $("#middle-name").val() + "</td><td>" 
     + $("#last-name").val() + "</td><td>" 
     + $("#dependents-birthday").val() 
     + "</td><td><input type='checkbox' disabled='disabled'" + checked 
     + "</td><td><button><span class='btn-edit-dependent glyphicon glyphicon-pencil'></span></button><button><span class='btn-delete-dep glyphicon glyphicon-trash'></td></tr>");
  });

  // delete dependent button
  $('.btn-delete-dep').click(function () {
     alert('m;lasfdj;adsdas');
  });
$('#dependents-info').on('click','.btn-delete-dep',function () {
     alert('m;lasfdj;adsdas');
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM