Streaming live at 10am (PST)

Modify form field attribute when checbox is marked


#1

Hello Everyone,

I need assistance with a problem (again...) I'm trying to make the field of a form both visible and required when a specific checkbox is marked.

Sadly I'm a real noob when it comes to code, so far this is what I've come up with:

Webflow.push(function() {
$('#Scrolling-Residential-Quote-form').click(function(e) {
if($('#esh').prop(':checked') {
document.getElementById("Kitchen-and-Cabinet-Area-quote-pop-up").attr('required', true);
document.getElementById("Kitchen-and-Cabinet-Area-quote-pop-up").style.display('block')
} else {
document.getElementById("Kitchen-and-Cabinet-Area-quote-pop-up").removeAttr('required');
document.getElementById("Kitchen-and-Cabinet-Area-quote-pop-up").style.display('none')
}
});
})

Nothing is happening and so far I'm going crazy...

PD: Please note the following

Form Name: "Scrolling-Residential-Quote-form"

Checkbox name: "esh"
Checkbox ID: "Kitchen-area-cabinets"

Field to be modified ID: "Kitchen-and-Cabinet-Area-quote-pop-up"

Thank you all for the help!