{hero}

language.search

Since: DataTables 1.10

Search input string.

Description

Sets the string that is used for DataTables filtering input control. It is overridable by the search.text string for a specific search input control.

The token _INPUT_, if used in the string, is replaced with the HTML text box for the filtering input allowing control over where it appears in the string. If _INPUT_ is not given then the input box is appended to the string automatically.

As of DataTables 2 the DOM structure that is generated can change based on the location of the _INPUT_ token in the string. If the token is at the start or the end of the string, the generated DOM will have the input outside of the label. This is done for accessability to allow an explicit link between the input and label (see this article for more details).

If the token is in the middle of the string, the DOM structure created will have the input nested in the label, creating an implicit link (although the for and id attributes are still set). Some screenreaders can struggle with this form and it is not recommended.

This DOM structure distinction is only of significance if you are applying custom styling to the page. You may need to alter your CSS depending on the string used.

Additionally, this property can benefit from the use of language.entries to easily update the string to relate to the specific type of data shown in the table. It's plural will always resolve to the plural wildcard. The _ENTRIES_ replacement token should be used where you want the resolved language.entries value to appear.

Type

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

Default

  • Value: Search:

Examples

Input text box will be appended at the end automatically:

new DataTable('#myTable', {
	language: {
		search: 'Filter records:'
	}
});

Custom text using language.entries:

new DataTable('#myTable', {
	language: {
		search: 'Filter _ENTRIES_:'
	}
});

Specify where the filter should appear:

new DataTable('#myTable', {
	language: {
		search: 'Apply filter _INPUT_ to table'
	}
});

Related

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