html - 样式联系表 7 单选按钮
问题描述
我正在尝试为 WordPress 的 Contact Form 7 插件生成的单选按钮设置样式。我见过的所有示例都依赖于带有for=""
参数的标签,如下所示:
<input type="radio" id="this-button" name="test-button">
<label for="this-button">Click Me</label>
但是 CF7 生成的按钮不允许您添加该for=""
参数。它在页面上看起来像这样:
<label>
<span class="wpcf7-list-item-label">Yes</span>
<input type="radio" id="yes" name="yes-button" value="Yes">
</label>
我仍然需要自定义单选按钮,但是还有另一种不依赖for=""
参数的方法吗?页面上已经加载了 jQuery,所以我可以使用 jQuery 解决方案。
任何帮助都会很棒,我尝试了几种解决方案,但都没有运气。
解决方案
Here's what ended up working for me:
I installed "Checkator", then added this:
//Add "checkator" class
$( document ).ready(function() {
$(".my-page label > input").addClass("checkator");
});
...at the top of fm.checkator.jquery.js
to add the "checkator" CSS class to the radio buttons.
Manually applying the CSS class to the radio buttons allowed Checkator to find them, and from there I was able to style them as needed.
推荐阅读
- xpath - Morningstar xpath 在 Google 表格中返回空(导入的内容为空)
- android - 您上传的 APK 未使用上传证书进行签名。您必须使用相同的证书
- c++ - ld:未找到架构 x86_64 的符号 - 错误
- oracle - Docker:从 Apache 容器连接到 Oracle 数据库容器时出现连接超时
- html - 如何使用 Bootstrap 构建动态搜索框
- tensorflow - Google colab pro GPU 运行速度极慢
- c - C中最小正数二维数组中的嵌套if循环
- javascript - 使用 superagent 和 Lumen API 被 CORS 策略阻止的请求
- python - 3.5 小时后仍然无法安装 Django - 我的毅力正在减弱
- google-apps-script - 将模板中的新工作表添加到原始 google 脚本中并组织到文件夹中