Show/Hide Fields
Show or hide form fields based on other field values — common for conditional questions and multi-step forms.
Show or hide form fields based on other field values — common for conditional questions and multi-step forms.
$("#type").on("change", function() {
const val = $(this).val();
$("#companyName").closest(".mb-3").toggle(val === "business");
$("#vatNumber").closest(".mb-3").toggle(val === "business");
});
// Initialize on page load
$("#type").trigger("change");
Call trigger("change") on page load to set the initial state for conditional fields.