删除表行不工作
Remove table row doesn't work
我试图从一个表格里面删除一个表行(tr)。我用这个函数来做。
$('.removeStop').click(function() {
$(this).closest('tr').fadeTo(400, 0, function () {
$(this).remove();
});
return false;
});
fadeTo工作得很好,但是当它要删除行时,它会去到remove函数,它会进入一个无限循环"cannot remove undefined"
也许这只是我犯的一些愚蠢的错误,但我想如果它可以淡出整个行,它应该能够删除相同的东西
任何帮助都将是伟大的:)
编辑:这里是HTML:
<tr align="left">
<td width="100">School: </td>
<td>
<select name="stops[school][0][studentid]" class="combobox" style="display: none; ">
<option value="">Select a school...</option>
<option value="1" selected="selected">Hogwarts School of Wizardry</option><option value="2">Itchy and Scratchy Land</option><option value="3">Springfield Elementary</option> </select><input class="ui-autocomplete-input ui-widget ui-widget-content ui-corner-left ui-corner-right inputCustom" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true">
</td>
<td width="70"></td>
<td width="100">Time (24hr): </td>
<td><input class="ui-widget ui-widget-content ui-corner-left ui-corner-right inputCustom" value="15" name="stops[school][0][hr]" style="width:50px;" type="text"> <input class="ui-widget ui-widget-content ui-corner-left ui-corner-right inputCustom" value="01" name="stops[school][0][min]" style="width:50px;" type="text"></td>
<td><a href="#" class="removeStop">Remove</a></td>
</tr>
试试这个:
$('.removeStop').click(function(e) {
e.preventDefault();
$(this).closest('tr').fadeOut(400, function () {
$(this).remove();
});
});
相关文章:
- button.单击两次删除附加操作后不工作
- Rails Production-可以工作,但不能编辑/删除/创建记录
- JavaScript-删除last();工作不正常
- javascript代码,用于删除firefox中的空白,但在IE和chrome中无法正常工作
- (X-Editable)与(Select2标签)不工作,可以't填充当前标签并跟踪添加/删除的标签
- 数据表中的FixedHead没有'删除分页后无法工作
- 无论如何都要获取文档.在不删除整个页面的情况下写入即可工作
- 我如何在谷歌工作表中找到一个完整的删除脚本
- .addClass不工作(刷新时被删除)
- domparser删除节点不工作
- appMobi/phonegap设置/删除cookie点击操作需要2次才能工作
- 删除功能不工作angularjs
- 如何删除 settimeOut 的队列工作
- java脚本退格键和删除在IE中工作,而不是在FireFox中工作
- 页面工作线程 - destroy() 似乎没有删除窗口对象
- 删除究竟如何工作
- 使用JS删除损坏的图像框无法正常工作.导轨 4.
- 单击按钮时的多重删除复选框无法按要求工作
- 简单的“删除工作表/插入工作表”脚本上的服务器错误
- 使用 jquery 删除 html 标记无法正常工作