我有这个jquery,它会加载,当你点击按钮,但我希望它加载页面加载时的函数。转换点击页面加载jquery
$("[src*=plus]").live("click", function() {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "images/minus.png");
});
$("[src*=minus]").live("click", function() {
$(this).attr("src", "images/plus.png");
$(this).closest("tr").next().remove();
});
我已经使用这个尝试,但它不工作:
$(document).ready(function() {
$(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
$(this).attr("src", "images/minus.png");
});
$(document).ready(function() {
$(this).attr("src", "images/plus.png");
$(this).closest("tr").next().remove();
});
您只使用一个$(文件)。就绪()和内部发生的一切。也是什么版本的jQuery是这样的?是不是已被弃用? – ThisGuyHasTwoThumbs
不确定。这是我找到代码的地方:https://www.aspsnippets.com/Articles/ASPNet-Nested-GridViews-GridView-inside-GridView-with-Expand-and-Collapse-feature.aspx –
Live实际上[已移除截至1.9版本](http://api.jquery.com/category/removed/#post-409)。 –