setCustomValidity

The HTMLSelectElement.setCustomValidity() method sets the custom validity message for the selection element to the specified message.

MDN Reference