How to hide the JavaScript validation messages programmatically?

Use the clearError() function of the mage.validation JavaScript widget:

Usage examples

1

2

3

4

5

As you can see, the last example also resets the form.