setCustomValidity

Sets a custom error message that is displayed when a form is submitted.

Parameters

error

Sets a custom error message that is displayed when a form is submitted.

MDN Reference