[英]How to add child nodes to parent nodes without having view jump to where element is being loaded?
[英]How to add a property/ styles to child nodes inside a parent element in angular
我有一張桌子
<table>
<thead>
<tr> </tr>
</thead>
<tbody>
<tr> </tr>
</tboday>
</table>
我想在<tbody>
中的<tr>
中添加一個屬性,而不是<thead>
添加此行后(<HTMLElement>document.querySelector('tr')).setAttribute("draggable", "true");
桌子看起來像
<table>
<thead>
<tr draggable=true> </tr>
</thead>
<tbody>
<tr> </tr> // note here there is no above mentioned property. I need to put here
</tboday>
</table>
如何在<tobdy>
中將draggable=true
添加到<tr>
>
這會幫助你
document.querySelector('tbody tr').setAttribute("draggable", "true");
<table> <thead> <tr></tr> </thead> <tbody> <tr>here </tr> </tbody> </table>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.