0
现在,当我点击使用类“BTN-危险”它会移除一个单独的按钮。如何修改我的函数,以便只在与正在运行的函数相关时删除任何内容?的onclick注册多个按钮具有相同的类名
function UpdateTrash(wo)
{
jQuery.ajax({
type: "POST",
url: "functions/markTrash.php",
data: 'wo='+wo,
cache: false,
success: function(response)
{
//alert("Record successfully updated");
}
});
}
$("#dataTables-example").on('click', '.btn-danger', function() {
$(this).parent().parent().remove();
});
$("#dataTables-example2").on('click', '.btn-danger', function() {
$(this).parent().parent().remove();
});
按钮:
<td><br><center><button type="button" name="trashButton1" class="btn btn-danger" onClick="UpdateTrash(<?php echo $orow['WorkOrder']; ?>);"/>Trash</button></a></center></td>
其他按钮:
<td><center>
<button type="button" name="rush1" class="btn btn-outline btn-danger" onClick="UpdateRush(<?php echo $orow['WorkOrder']; ?>);"/>Rush</button>
</center><br><center>
<button type="button" name="pool1" class="btn btn-outline btn-info" onClick="UpdatePool(<?php echo $orow['WorkOrder']; ?>);"/>RFP</button></a>
</center></td>
问题描述不是很清楚。你可以创建一个JsFiddle来演示这个问题吗? –