{hero}

div.text

Since: DataTables 2.1

Set the text content for the element.

Description

This option is used to set the text content (i.e. textContent in DOM API terms) for the div that is created by the div feature. This option and div.html are complimentary, but not to be used together. They both set the content of the div, but in this case any HTML in the string will be escaped making it safe for uncontrolled user input. Use div.html if you want to create HTML elements.

Example

Set text:

new DataTable('#myTable', {
	layout: {
		top: {
			div: {
				text: 'Safe content: <button>BTN</button> will be rendered as text'
			}
		}
	}
});

Related

The following options are directly related and may also be useful in your application development.