tommj
0
Q:

jquery is child of

Syntax:
$(selector).children()

<style> 
  .parent * { 
    display: block; 
    border: 2px solid lightgrey; 
    color: grey; 
    padding: 5px; 
    margin: 15px; 
  } 
</style> 
<script src="https://ajax.googleapis.com/ajax/libs/ 
jquery/3.3.1/jquery.min.js"></script> 
<script> 
  $(document).ready(function() { 
  $("div").children().css({ 
    "color": "green", 
    "border": "2px solid green" 
  }); 
}); 
</script> 

<div class="parent" style="width:500px;">This is the current element !!! 
  <p>This is first children 
    <span>This is grandchild</span> 
  </p> 
  <p>This is Second children 
    <span>This is grandchild</span> 
  </p> 
</div> 
1
if($(target).parents('.wrapper').length > 0) {
   //do something...
}
0

New to Communities?

Join the community