{hero}

buttons().nodes()

自:Buttons 1.0.0 起

取得所選按鈕的按鈕節點。
請注意 - 此屬性需要 DataTables 的 Buttons 擴充套件。

描述

通常,能夠存取按鈕的 DOM 節點會很有用,這樣您就可以使用 jQuery 或 DOM 方法直接操作它。 此方法正好提供了這個選項。

類型

function buttons().nodes()

描述

取得一個 jQuery 物件,其中包含所選按鈕的節點參考。

傳回

一個 jQuery 物件,其中包含所選按鈕的節點。

範例

設定所選按鈕的背景顏色

var table = new DataTable('#myTable');

table
	.buttons('.important')
	.nodes()
	.css('background', 'red');

將自訂點擊事件處理常式新增至所選按鈕

var table = new DataTable('#myTable');

table
	.buttons('.data')
	.nodes()
	.on('click', function (e) {
		console.log('Button clicked!');
	});