[removed] How to get parent element by selector?

前端 未结 9 480
忘掉有多难
忘掉有多难 2020-12-02 16:31

Example:

....
<
9条回答
  •  [愿得一人]
    2020-12-02 17:08

    Here is simple way to access parent id

    document.getElementById("child1").parentNode;
    

    will do the magic for you to access the parent div.

    
    
    
    
    
    
    Master
    Child

提交回复
热议问题