0

我需要在实体列表中创建一个名为下载的新菜单项。html 目前看起来像这样:

<td aria-label="action menu">
 <div class="dropdown action">
     <button class="btn btn-default btn-xs aria-exp" data-toggle="dropdown" aria-expanded="false" aria-label="action menu"> 
       <span class="fa fa-chevron-circle-down fa-fw" aria-hidden="true"></span>
     </button>
     <ul class="dropdown-menu" role="menu" style="position: fixed;">
       <li role="none">
           <a class="edit-link" role="menuitem" tabindex="-1" href="mypage?id=2f7d48cf-e98a-ec11-b820-0003ff6ac000" title="Edit" aria-setsize="1" aria-posinset="1">Edit</a>
       </li>
    </ul>
 </div>
</td>

我只需要在它下面再添加两个 li 。到目前为止使用的 JQuery 可以加载 html,但我被困在如何附加菜单项上。

var list = $(".entity-grid")
list.on("loaded", function () {

if (list.find(".view-grid .table tbody tr td:last-child ul.dropdown-menu > li > a.details-link, .view-grid .table tbody tr td:last-child ul.dropdown-menu > li > a.edit-link, .view-grid .table tbody tr td:last-child ul.dropdown-menu > li > a.deactivate-link, .view-grid .table tbody tr td:last-child ul.dropdown-menu > li > a.delete-link, .view-grid .table tbody tr td:last-child ul.dropdown-menu > li > a.disassociate-link").length > 0) {
        var rows = $(this).find(".view-grid .table tbody tr td:last-child");
        $.each(rows, function (index, row) {
             //add new menu item here
             console.log('download PDF');
        });
    }

}); 
4

0 回答 0