Show/Hide Field based on Checkbox Selection
Posted: 16 Oct 2019
Hi,
I have a multichoice checkbox and another field. I want to be able to show or hide the field if the first item in the checkbox list is selected. I've done the following code but it's not working. Please advise.
function setSafetyImpact(){
var checkboxIndex=0;
if(fd.field('EventImpact').control()._el().find('input[type="checkbox"]').eq(checkboxIndex).is(':checked')){
//show field
$('.safety-impact').show();
}else{
//hide field
$('.safety-impact').hide();
}
}
fd.field('EventImpact').change(setSafetyImpact);
setSafetyImpact();
I have a multichoice checkbox and another field. I want to be able to show or hide the field if the first item in the checkbox list is selected. I've done the following code but it's not working. Please advise.
function setSafetyImpact(){
var checkboxIndex=0;
if(fd.field('EventImpact').control()._el().find('input[type="checkbox"]').eq(checkboxIndex).is(':checked')){
//show field
$('.safety-impact').show();
}else{
//hide field
$('.safety-impact').hide();
}
}
fd.field('EventImpact').change(setSafetyImpact);
setSafetyImpact();