{hero}

buttons.buttons.attr

Since: Buttons 3.0.0

Collection of attribute key / values to set for a button.
Please note - this property requires the Buttons extension for DataTables.

Description

This option provides the ability to set any arbitrary attribute on the button's HTML element in the document. This can be useful for customisation of attributes such as ARIA assistive attributes, setting a custom id for selection / styling, custom data parameters, etc.

Type

object

Description:

The attributes assigned to the button are defined by the parameter key being used for the attribute name and the value being used as the attribute's value. In this way multiple attributes can be set.

Default

  • Value: No default value (i.e. undefined)

Example

Copy button with title text and an id:

new DataTable('#myTable', {
	layout: {
		topEnd: {
			buttons: [
				{
					extend: 'copyHtml5',
					attr: {
						title: 'Copy',
						id: 'copyButton'
					}
				}
			]
		}
	}
});