我有這個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)。 –