button().node()
Since: Buttons 1.0.0
Get the button node for the selected button.
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 button().node()
- Description:
Get a jQuery object that contains a reference to the node for the selected button.
- Returns:
A jQuery object that contains the node of the selected button
Examples
Set the background colour for button index 0:
var table = $('#myTable').DataTable();
table
.button( 0 )
.nodes()
.css( 'background', 'blue' );
Add a custom click event handler to a selected button:
var table = $('#myTable').DataTable();
table
.button( 'copy:name' )
.nodes()
.on( 'click', function ( e ) {
console.log( 'Copy button clicked!' );
} );