{hero}

caption

Since: DataTables 2.0

Set a caption for the table.

Description

HTML tables have the ability to show a caption which gives brief summary of what the contents of the table are to the end user. This is done through the optional element called caption.

If your table has a caption tag, it will be used automatically. Setting a value using this property will cause the caption's existing value to be overwritten. If there is no caption in the table and a value is given to this property, the caption will be created.

Please note that the position of the caption is controlled by the CSS caption-side property - it can be shown above or below the table.

Type

This option can be given in the following type(s):

Default

null - do not show a caption, unless there is one in the original HTML table.

Example

Set a caption for the table:

$('#myTable').DataTable({
	caption: 'Table 1: Pupil averages'
});

Related

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