Hide div with javascript when there is no link - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:css

Description

Hide div with javascript when there is no link

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
 </head> /*from w w w . ja  v  a  2s.  c o m*/
 <body> 
  <div class="pages">
    asdf
  </div> 
  <div class="pages2"> 
   <a href="#">asdf</a> asdf
  </div> 
  <script type="text/javascript">
$('.pages:not(:has(>a))').css("display", "none");

      </script>  
 </body>
</html>

Related Tutorials