Skip to content

Commit 3c3d2de

Browse files
committed
added check id
1 parent 94c670b commit 3c3d2de

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

resources/views/googlerecaptchav3/template.blade.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@
2323
function onloadCallback() {
2424
@foreach($mappers as $action=>$fields)
2525
@foreach($fields as $field)
26-
let client{{$field}} = grecaptcha.render('{{$field}}', {
27-
'sitekey': '{{$publicKey}}',
28-
@if($inline===true) 'badge': 'inline', @endif
29-
'size': 'invisible',
30-
'hl': '{{$language}}'
31-
});
32-
grecaptcha.ready(function () {
33-
grecaptcha.execute(client{{$field}}, {
34-
action: '{{$action}}'
35-
});
36-
});
26+
if (document.getElementById('{{$field}}')) {
27+
let client{{$field}} = grecaptcha.render('{{$field}}', {
28+
'sitekey': '{{$publicKey}}',
29+
@if($inline===true) 'badge': 'inline', @endif
30+
'size': 'invisible',
31+
'hl': '{{$language}}'
32+
});
33+
grecaptcha.ready(function () {
34+
grecaptcha.execute(client{{$field}}, {
35+
action: '{{$action}}'
36+
});
37+
});
38+
}
3739
@endforeach
3840
@endforeach
3941
}

0 commit comments

Comments
 (0)