button().node()
自:Buttons 1.0.0
取得所選按鈕的按鈕節點。
請注意 - 此屬性需要 DataTables 的 Buttons 擴充功能。
說明
通常,能夠存取按鈕的 DOM 節點會很有用,這樣您就可以使用 jQuery 或 DOM 方法直接操作它。此方法正好提供了這個選項。
類型
範例
設定按鈕索引 0 的背景顏色
var table = new DataTable('#myTable');
table
.button(0)
.nodes()
.css('background', 'blue');
為選定的按鈕新增自訂點擊事件處理器
var table = new DataTable('#myTable');
table
.button('copy:name')
.nodes()
.on('click', function (e) {
console.log('Copy button clicked!');
});