onError( )

Adds an event handler that runs when a connection error occurs while completing the CAPTCHA challenge.

The onError() function allows you to perform actions when the reCAPTCHA element on the client side loses connection with the CAPTCHA provider.

If an error occurs, the reCAPTCHA element automatically resets. You can ask the site visitor to retry the CAPTCHA challenge later.

Method Declaration
Method Parameters

handler(): void The name of the function or the function expression to run when an error occurs.

Was this helpful?