Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Target one specific Jquery Data Table theader for CSS styles

$(document).ready(function() {

  $('#example').DataTable( {

    "initComplete": function ( settings ) {
      $('#example thead tr th').each(function() {
        if ($(this).html() === 'Office') {
            $(this).css("color", "goldenrod");
        }
      }); 
    }

  } );

} );
Comment

Target one specific Jquery Data Table theader for CSS styles

<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Demo</title>
  <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  <script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css">
  <link rel="stylesheet" type="text/css" href="https://datatables.net/media/css/site-examples.css">


</style>

</head>

<body>

<div style="margin: 20px;">

    <table id="example" class="display dataTable cell-border" style="width:100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
            </tr>
            <tr>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011/07/25</td>
                <td>$170,750</td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>
 Run code snippet
Comment

PREVIOUS NEXT
Code Example
Javascript :: Scaling elements proportionally using CSS and JQUERY3 
Javascript :: remove symbols from cnpj js 
Javascript :: Browser globals 
Javascript :: on veiwport reveal javascript 
Javascript :: debugJSON 
Javascript :: get the character code in a string 
Javascript :: fireOnChange 
Javascript :: How to access POST form fields in Express 
Javascript :: vscode search shortcut 
Javascript :: insert image in jsp page 
Javascript :: TypeError: (intermediate value).addBooks is not a function in js 
Javascript :: javascript loop through collection of objects 
Javascript :: select random quotes from array called anecdotes 
Javascript :: Getting Terms From An Array 
Javascript :: phaser wrap group 
Javascript :: creating hashblock method using sha256 hashing algorithm 
Javascript :: Staircase 
Javascript :: import local js file node 
Javascript :: React Native - iOS Release build crashing 
Javascript :: Calculator for two numbers 
Javascript :: Turn A 2D Array Into A JSON 
Javascript :: nestjs prisma controller 
Javascript :: pass data between router components 
Javascript :: How to Loop Through an Array with a do…while Loop in JavaScript 
Javascript :: how to set javascript load order in html 
Javascript :: merge large arrays 
Javascript :: unknown set of argument 
Javascript :: javascript get max value in array of objects 
Javascript :: js 
Javascript :: how to nested schema mongoose 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =