OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

.closest() in CSS

  • Thread starter Thread starter Lorraine Bernard
  • Start date Start date
L

Lorraine Bernard

Guest

I am able to hide a DOM tree which look in this way by using .closest().

Code:
<div class='parent'>
  <!-- some html code -->
  <div class='child'>
  </div>
  <!-- some html code -->
<div>

$('.child').closest('parent').hide();

It will be possible to get the same effect just by using CSS?
If yes, how?

<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector">Is there a CSS parent selector?</a> </p>
</blockquote>



<p>I am able to hide a DOM tree which look in this way by using <code>.closest()</code>.</p>

<pre><code><div class='parent'>
<!-- some html code -->
<div class='child'>
</div>
<!-- some html code -->
<div>

$('.child').closest('parent').hide();
</code></pre>

<p>It will be possible to get the same effect just by using CSS?<br>
If yes, how?</p>
 

Online statistics

Members online
0
Guests online
4
Total visitors
4
Top