2

The default message if I am not a robot is

g-recaptcha-response is required

I want to change it to something else like

Recaptcha is required

I tried the following but didn't work

function onClickSearch(e) {
  e.preventDefault();

  var v = grecaptcha.getResponse();
  if (v.length == 0) {
    document.getElementById('g-recaptcha-response').innerHTML = '<span class="k-icon k-iwarning">reCAPTCHA response is required.</span>';
    return false;
  }
} 
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Joel HJ
  • 181
  • 1
  • 5
  • 1
    Which validation library are you using? – Rory McCrossan Dec 05 '19 at 14:02
  • I am currently not using any validation library. I am doing this in .NET CORE 2.2 Razor Page – Joel HJ Dec 05 '19 at 15:35
  • What type of [reCAPTCHA integration](https://developers.google.com/recaptcha/intro) are you using? (V3, V2, Invisible, Checkbox, etc.) Can you share your relevant markup? – Tom Faltesek Dec 05 '19 at 15:59
  • I am using reCaPTCHA V2
    window.onload = function () { var $recaptcha = document.querySelector('#g-recaptcha-response'); if ($recaptcha) { $recaptcha.setAttribute("required", "required"); }; } Tried the following but can get the right message to appear on check box not check
    – Joel HJ Dec 05 '19 at 18:44

0 Answers0