Simple way to get element by id within a div tag?

后端 未结 8 608
忘了有多久
忘了有多久 2020-12-04 19:44

Please forgive me if I repeat the question.

I have HTML that all elements inside a div tag has different id, suppose I have already get the reference to the div, is

8条回答
  •  心在旅途
    2020-12-04 20:12

    A simple way to do what OP desires in core JS.

    document.getElementById(parent.id).children[child.id];
    

提交回复
热议问题