<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div id="test">
<h2>DOM contains methods</h2>
<p>lorem ipsum</p>
<p id="abc">lorem ipsum</p>
</div>
<script>
var parentElement = document. getElementById("test");
var target = document.getElementById("abc");
var find = parentElement.contains(target);
console.log(find);
</script>
</body>
</html>
OUTPUT
Comments
Post a Comment