Change CSS based on certain DIV content - Javascript jQuery

Javascript examples for jQuery:CSS

Description

Change CSS based on certain DIV content

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> 
  <script type="text/javascript">
    $(function(){/*  ww w.  ja v  a  2s. co m*/
var chktxt = $.trim($('.checkbox').text());
if(chktxt == 0){
    $('#checkbox').hide();
}else{
    $('#checkbox').show();
}
    });

      </script> 
 </head> 
 <body> 
  <div class="checkbox">
    1 
  </div> 
  <input type="checkbox" id="checkbox" value="">  
 </body>
</html>

Related Tutorials