Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在回调函数“OnSuccess”中,我无法获取我点击的元素。单击“Del”按钮后,我尝试删除我刚刚单击的“Del”按钮中的“tr”元素。如何做到这一点?
您可以使用 jquery 将其删除:
$('#selector').remove();
还要检查一下:
JavaScript DOM 移除元素
我使用组合$(this)来获取按钮(或触发它的其他 dom 元素)。
$(this)
然后.closest用tr参数获取行。
.closest
tr
随后.remove将其删除:
.remove
$(this).closest('tr').remove();