I need to access the DOM tree and get the elements just 1 level below the current element.
Read the following code:
8条回答 逝去的感伤 (楼主) 2021-02-05 21:22 In my opinion the easiest way to do this is to add a class name to the first level child nodes: and then to use the method getElementsByClassName, so in this case: document.getElementById('node').getElementsByClassName('level_1'); 0 讨论(0) 查看其它8个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
In my opinion the easiest way to do this is to add a class name to the first level child nodes:
and then to use the method getElementsByClassName, so in this case:
getElementsByClassName
document.getElementById('node').getElementsByClassName('level_1');