showing results for - "js check if div have another div"
Christy
20 Jun 2016
1<script>
2    window.onload = function() {
3        var parentDiv = document.getElementById("commentBox");
4        var childDiv = document.getElementById("comment1");
5        if (parentDiv.contains(childDiv)) {
6            alert("yes");
7        } else {
8            alert("no");
9        }
10    }
11</script>
12<div class="row leftpad collapse" id="commentBox">
13    <div id="comment1">
14        <div class="col-md-3 dir-rat-left"> <i class="fa fa-user-circle" aria-hidden="true"></i>
15            <h6>James </h6>
16        </div>
17        <div class="col-md-9 dir-rat-right">
18            <p class="removemarg">always available, always helpfull that goes the same for his team that work with him - definatley our first phone call.</p>
19        </div>
20    </div>
21</div>
22