<html>
<head>
<script src="../../ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").click(function(){
if ($("p").parent().is("div")) {
alert("Parent of p is div");
}
});
});
</script>
</head>
<body>
<div>
<p>Click me to find out if I my parent is a div element.</p>
</div>
</body>
<!-- Mirrored from www.w3schools.com/jquery/tryit.asp?filename=tryjquery_traversing_is by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:14:08 GMT -->
</html>