jQuery expand/collapse hierarchical table row

前端 未结 3 730
不知归路
不知归路 2021-02-09 23:14

I am looking for an efficient way to expand/collapse hierarchical table rows using jQuery. The problem is, that the expand and collapse functionality differs.

  • Init
3条回答
  •  遇见更好的自我
    2021-02-09 23:36

    The table html in your post is not valid (tr enclosed by td). On the properly structured table, this code works.

    $("tr.level_0").live("click", function () {
      $(this).nextUntil(".level_0").toggle();
    });
    

提交回复
热议问题