MCPcopy
hub / github.com/autoNumeric/autoNumeric / setInvalidState

Method setInvalidState

src/AutoNumericHelper.js:1295–1299  ·  view source on GitHub ↗

* Set the invalid state for the given element. * A custom message can be passed as the second argument. * Note: This does not work with contenteditable elements * * @param {HTMLElement|HTMLInputElement} element * @param {string|null} [message='Invalid'] Custom message (optio

(element, message = 'Invalid')

Source from the content-addressed store, hash-verified

1293 * @throws Error
1294 */
1295 static setInvalidState(element, message = 'Invalid') {
1296 if (message === '' || this.isNull(message)) this.throwError('Cannot set the invalid state with an empty message.');
1297
1298 element.setCustomValidity(message);
1299 }
1300
1301 /**
1302 * Set the valid state for the given element.

Callers 1

_setInvalidStateMethod · 0.80

Calls 2

isNullMethod · 0.95
throwErrorMethod · 0.95

Tested by

no test coverage detected