{hero}

div.html

Since: DataTables 2.1

Set the HTML content for the element.

Description

This option is used to set the HTML content (i.e. innerHTML in DOM API terms) for the div that is created by the div feature. This option and div.text 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 __not_ be escaped making it unsafe for uncontrolled user input. Use div.text if you want plain strings. However, this option is useful for controlled input - i.e. a string you set yourself.

Example

Set HTML content:

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

Related

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