Conditional fields in contact form 7 not working


In my contact form I need a drop down for order quantities. On selection of “other”, I want to display a number field for input. Below is my code but it’s not working. Can anyone help? Thanks in advance.

<script language="javascript" type="text/javascript">
document.getElementById("OrderQuantity").addEventListener("change", displayNumberField);
  function displayNumberField() {
    var dropDownText =  document.getElementById("OrderQuantity").value;
    if (dropDownText == "Other") {
      document.getElementById("EnterOtherQuantity").style.display = 'block';
    } else {
      document.getElementById("EnterOtherQuantity").style.display = 'none';

<label> Order Quantity
[select* drop-down-menu id=OrderQuantity "Select Quantity" "10" "20" "30" "40" "Other"] </label>

<label id="EnterOtherQuantity" style="display:none;"> Please Specify Your Order Quantity
[number other-order-quantity min:41] </label>
, WP-Bee 5 years 2018-07-27T12:44:16-05:00 0 Answers 73 views 0

Leave an answer