首页 > 解决方案 > 如何在 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>

关于我应该改变什么的任何想法?谢谢

标签: javascripthtmljquerysquarespaceweb-site-project

解决方案


推荐阅读