大家好我正在使用Wordpress Contact Form 7插件并尝试实现: Show text field if drop down "Other" is selected
在联系表单7中添加 dropdown
作为id之后,我现在通过Wordpress页面中的Visual composer使用以下原始JS:
var x = document.getElementById("dropdown");
if(x.value = "Other") {
alert('Enter your js here!');
}
1 回答
对于任何寻求更简单解决方案的人 . 在联系表单7中,您只需添加内联JavaScript即可 .
只要不在脚本中添加空行,添加到表单构建器的JavaScript就会在前端呈现 .
这是来自CF7表单编辑器的副本:
希望有所帮助 .
如果您有兴趣阅读更多内容或扩展相同的单选按钮,我最近发表了一篇文章,其中包含更多代码示例和示例here .