Applying css background property to inner div inside table using root class name

Using below code we can apply css into table div by using root class name.


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('.rootClass table div').css('background', 'green');
        });
    </script>
</head>
<body>
    <div class="rootClass">
  <h3>Header</h3>
  <div>
     <p>this is para</p>
     <div>second para</div>
     <div>
         <table border="1">
           <tbody><tr><td><div>aspnettutorialonline.blogspot.com</div></td><td>THis is second column</td></tr></tbody>
         </table>
     </div>
   </div>
</div>
</body>
</html>
Output:


Applying css background property to inner div inside table using root class name
Applying css background property to inner div inside table using root class name
 

Post a Comment