javascript - 如何在 SquareSpace 上的下拉框中添加条件表单
问题描述
我希望隐藏表单,直到用户从下拉框中选择“其他”,这是我到目前为止的代码,但表单不会显示。
<style>
/* This hides the prefooter area */
#preFooter {
display: none;
}
#text-yui_3_17_2_1_1592488106653_18663-field {display: none;}
#text-yui_3_17_2_1_1592488106653_17373-field {display: none;}
</style>
<footer>
<script
src="https://code.jquery.com/jquery-3.5.1.min.js"
integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
crossorigin="anonymous"></script>
<script>
$('#select-yui_3_17_2_1_1592428429486_20443 input').click(function() {
selection = $(this).val();
if (selection == 'Other (please specify)') {
$('.form-item').show();
}};
</script>
</footer>
关于我应该改变什么的任何想法?谢谢
解决方案
推荐阅读
- mysql - Mysql-Specified key was too long-不明白为什么?
- c# - List.Count() 在 DevOps 构建中抛出 ArgumentOutOfRangeException,但不是在本地
- c# - C# Winforms - IF 语句的问题
- elasticsearch - ElasticSearch - [nested] 未能在路径下找到嵌套对象
- c - Visual Studio 中的远指针声明
- maven - Maven 似乎忽略了 MAVEN_OPTS
- javascript - FullCalendar.js - 避免本周的事件?
- python - 从 url 下载 csv 并使其成为数据框 python pandas
- postgresql - 在 postgresql 中使用多个左连接
- c++ - 两次删除对象并导致内存错误