jQuery父对象(“tr”)淡出不起作用
jQuery parents("tr") fadeout not working
所以我试图创建一个带有class"delete"父tr元素的fadeOut效果。
这是我的jsfiddle,你可以在那里实时查看它-http://jsfiddle.net/syTXZ/
代码在这里-
HTML-
<table border="1px solid black">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Parent</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr>
<td>2</td>
<td>test222</td>
<td>test2</td>
<td><a href="#" categoryID="1" class="edit">Edit Category</a></td>
<td><a href="#" categoryID="1" class="delete">Delete Category</a></td>
</tr>
<tr>
<td>1</td>
<td>te1t22</td>
<td>tes1t</td>
<td><a href="#" categoryID="1" class="edit">Edit Category</a></td>
<td><a href="#" categoryID="1" class="delete">Delete Category</a></td>
</tr>
<tr>
<td>3</td>
<td>test2</td>
<td>test</td>
<td><a href="#" categoryID="1" class="edit">Edit Category</a></td>
<td><a href="#" categoryID="1" class="delete">Delete Category</a></td>
</tr>
</tbody>
</table>
和js-
$("a.delete").click(function() {
$(this).parents("tr").fadeOut(300);
}
但它不起作用,有线索吗?我也尝试了parent()而不是parents(),但它也不起作用。
更新了修复程序:jsFiddle
您缺少);
$("a.delete").click(function() {
$(this).parents("tr").fadeOut(300);
}
应该是
$("a.delete").click(function() {
$(this).parents("tr").fadeOut(300);
});
$("body").delegate("a.delete","click",function() {
$(this).parent().parent().fadeOut(300);
});
演示
应该是
$("a.delete").click(function() {
$(this).parents("tr").fadeOut(300);
});
相关文章:
- 添加/删除类淡入淡出不起作用
- 淡入淡出脚本不起作用
- 纯 JavaScript 淡入淡出 - 淡入不起作用
- 淡入淡出链接悬停不起作用
- 淡出加载然后淡入不起作用
- jQuery图像淡入淡出不起作用
- jQuery父对象(“tr”)淡出不起作用
- 淡入淡出和AppendTo不起作用-jQuery
- jquery 和 safari 7 - slide切换和淡入淡出切换不起作用
- function(){如果淡出,则追加}不起作用
- 淡入淡出 JavaScript 中的图像不起作用
- 为什么这种淡出不起作用
- JQuery 幻灯片向上和淡出“不起作用”
- 淡入和淡出功能不起作用
- 淡入/淡出功能不起作用
- 淡出功能在所有浏览器中都不起作用
- 为什么这种淡入淡出效果不起作用
- Ajax.BeginForm淡出不起作用
- 为什么淡出不起作用
- 滚动时jQuery淡出不起作用