cells().nodes()

Since: DataTables 1.10

Get the DOM elements for the selected cells.

Description

This method, used in-combination with the cells() method (and therefore the various selector forms that it allows) will obtain the DOM nodes for the selected cells, allowing them to be directly manipulated - for example adding a class.

Type

cells().nodes()

Get the DOM elements for the selected cells

Returns:

DataTable.Api: DataTables API instance with the TD / TH cell elements in the set

Example

Add a class to the selected cells:

var table = new DataTable('#myTable');
var cells = table.cells().nodes();

// Option 1, with `classList`
cells.toArray().forEach(el => el.classList.add('warning'));

// Option 2, using `DataTable.Dom`:
cells.toDom().classAdd('warning');

Related

The following options are directly related and may also be useful in your application development.