javascript get child by id

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

I want to change the style of the child div

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 17:56

    This works well:

    function test(el){
      el.childNodes.item("child").style.display = "none";
    }
    

    If the argument of item() function is an integer, the function will treat it as an index. If the argument is a string, then the function searches for name or ID of element.

提交回复
热议问题