Skip to content

contains rule (v3)

Require the input to contain a given string.

Since
1.0.11
Signature
contains(input, string)
Options
1

Usage

contains usage
bootstrapValidate('#input', 'contains:something:Your text needs to contain something!')

Options

Name Description Example
string string: String to appear in the Input Element something

Live Example

Checking...

Source

contains source
/**
* @since 1.0.11
* @param string string: String to appear in the Input Element
* @description Require the input to contain a given string.
* @example something
* @error Your text needs to contain something!
*/
export default function contains(input: RuleInput, string: RuleOption) {
return input.value.includes(String(string));
}