reCAPTCHA - 按提交后出现
我想在我的表单中使用 reCAPTCHA。用户必须填写表格,然后按“提交”。之后,在“提交”按钮下,应该会出现 reCAPTCHA。
我怎样才能做到这一点?
I wanna use reCAPTCHA for my form. The user must fill the form and then press "Submit". After this, under the "Submit"-Button, reCAPTCHA should appear.
How I can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果我想要这样的东西,我可能会将 reCAPTCHA 预加载到 jQuery 对话框 中。
我认为,当用户按下按钮时,用户可能会对页面上看似随机出现的验证码感到困惑,但出现一个对话框来确认某些信息并不罕见。
If I were to want something like this, I would probably preload the reCAPTCHA into a jQuery dialog.
I think a user might get confused by a Captcha just appearing seemingly at random on the page when they press a button, but having a dialog come up to confirm some information is not unusual.
我只需要做你想做的事,所以最初隐藏 reCaptcha 并在提交时显示它。
所以我用 CSS 隐藏了它:
然后当有人开始填写表单时用 jQuery 显示它,所以在输入字段焦点上:
I just needed to do what you wanted, so initially keep reCaptcha hidden and show it on submit.
So I've hidden it with CSS:
And then showed it with jQuery when someone starts to fill in the form, so on input field focus:
2021 年,联系表 7 用户
如果您使用联系表 7,那么您需要进行一些更改。我在这里使用@Mike 代码,几乎没有什么变化。
隐藏 reCAPTCHA
“Contact form 7”包装类是
wpcf7-form-control-wrap
recaptcha
(两个类),它位于span
容器,所以需要使用这样的样式。这里两个类之间没有空格。单击以显示
使用“联系表单 7”窗口中的表单标签将
id:submit
添加到您的提交按钮。并在这里使用 id。
2021, Contact form 7 Users
If you are using contact form 7 then you need to change a little bit. I am using the @Mike code here with little changes.
Hiding the reCAPTCHA
The 'Contact form 7' wrapper class is
wpcf7-form-control-wrap
recaptcha
(two classes) and it is on aspan
container, so you need to use the style like this. No spaces between two classes here.Click to show
Add
id:submit
to your submit button using the form-tag in the Contact Form 7 window.And use the id here.