私はこのjqueryを持っています。ボタンをクリックするとロードされますが、ページがロードされたときに関数をロードします。コンバートClick to page load 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();
});
私はこれを使って試してみたが、それは仕事をdoesntの:
$(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のどのバージョンですか? .liveは推奨されていませんか? – ThisGuyHasTwoThumbs
不明です。これは私がコードを見つけた場所です:https://www.aspsnippets.com/Articles/ASPNet-Nested-GridViews-GridView-inside-GridView-with-Expand-and-Collapse-feature.aspx –
ライブは実際には削除されましたバージョン1.9以降](http://api.jquery.com/category/removed/#post-409)。 –