Add Conditional form Field [Debut]

Highlighted
Tourist
7 1 1

Adding a drop-down select to a form using the UI Generator.

I want to show the Unit (text box) if Apartment is chosen.

<p class="line-item-property__field">
<label>Location Type</label><br>
<select required class="required" id="location-type" name="properties[Location Type]">
<option value="Apartment">Apartment</option>
<option value="Home">Home</option>
<option value="Business">Business</option>
</select>
</p>
<p class="line-item-property__field">
<label for="unit">Unit #</label>
<input required class="required" id="unit" type="text" name="properties[Unit #]">
</p>

Tried a variation of this answer but I can't get a consistent result with product variant titles so I didn't spend time trying to apply it here.

0 Likes