buttons().nodes()
Since: Buttons 1.0.0
Get the button nodes for the selected buttons.
Please note - this property requires the Buttons extension for DataTables.
Description
It can often be useful to have access to the DOM node of a button so you can manipulate it using directly jQuery or DOM methods. This method provides exactly that option.
Type
function buttons().nodes()
- Description:
Get a jQuery object that contains a reference to the nodes for the selected buttons.
- Returns:
A jQuery object that contains the nodes for the selected buttons
Examples
Set the background colour for selected buttons:
var table = $('#myTable').DataTable();
table
.buttons( '.important' )
.nodes()
.css( 'background', 'red' );
Add a custom click event handler to the selected buttons:
var table = $('#myTable').DataTable();
table
.buttons( '.data' )
.nodes()
.on( 'click', function ( e ) {
console.log( 'Button clicked!' );
} );