[英]Find child and remove its parent using jquery?
I'm able to find the child but can not remove its parent, which is the td row 我可以找到孩子,但无法删除其父,这是td行
<tr><td><input type="checkbox"></td><td>Test Information</td></tr>
$(rowHtml).find('input').parent().remove();
I would like the following output: 我想要以下输出:
<tr><td>Test Information</td></tr>
try this: 尝试这个:
$(rowHtml).closest('tr').find('td:first').find('input').remove();
I have added this code in Jsfiddle check this: http://jsfiddle.net/4E5zP/1/ 我已经在Jsfiddle中添加了此代码,请检查以下内容: http : //jsfiddle.net/4E5zP/1/
确保关闭表情
$(rowHtml).click(function() { $(this).parent().remove();});
I just added a class name to the parent of the input element and remove it 我刚刚在输入元素的父类中添加了一个类名,并将其删除
<tr><td class="inputTD"><input type="checkbox"></td><td>Test Information</td></tr>
$(rowHTML).find(".inputTD").remove().end();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.