Skip to content

startsWith rule (v3)

Require the input value to start with a given string.

Since
1.1.0
Signature
startsWith(input, string)
Options
1

Usage

startsWith usage
bootstrapValidate('#input', 'startsWith:+49:Your phone number needs to start with +49')

Options

Name Description Example
string string: String the input value should start with +49

Live Example

Checking...

Source

startsWith source
/**
* @since 1.1.0
* @param string string: String the input value should start with
* @example +49
* @error Your phone number needs to start with +49
* @description Require the input value to start with a given string.
*/
export default function startsWithRule(input: RuleInput, string: RuleOption) {
return startsWith(input.value, String(string));
}