Hello,
I have a sharepoint field which has the type yes/no and a a button from the control fields. I would like that when I choose for example yes that the button field changes the color to green and if I choose no the button should turn red. The change should happen dynamically while someone chooses yes or no without the need to save the ticket everytime.
Thanks, Yücel
Hi @Yucelll,
Try giving the button a special class like this:
Then add this JS code to the form to change the background color of all elements with that class:
fd.rendered(function () {
fd.field('YesNo').$on('change', (value) => {
if (value == 'yes') {
$('.changing-color').find('.fd-button').css("background-color", "green");
} else {
$('.changing-color').find('.fd-button').css("background-color", "red");
}
});
});
1 Like