javascript get child by id

后端 未结 4 1243
广开言路
广开言路 2020-12-13 17:23
Test
child

I want to change the style of the child div

4条回答
  •  一整个雨季
    2020-12-13 17:48

    document.getElementById('child') should return you the correct element - remember that id's need to be unique across a document to make it valid anyway.

    edit : see this page - ids MUST be unique.

    edit edit : alternate way to solve the problem :

    Test
    child

    then you just need the test() function to look up the element by id that you passed in.

提交回复
热议问题