How to hide one or more fields when checking a checkbox?

Hi! I want the browser can automatically hide/show one or more fields when user uncheck/check a checkbox. I scratched some codes but do not know which event to put them in, any suggestion? Thanks!

The codes:

if ($this->A_field == 0) {
$this->B_field->Visible = FALSE;
$this->C_field->Visible = FALSE;
}

You may use Client Side Event, see the example in the topic Field Setup → Edit Tag → Client Side Events in the help file.

Thank you!
But I follow the sample, and changed the codes to:

if (this.value == 0) {
$(this).fields(“B_Filed”).visible(false);
} else {
$(this).fields(“B_Filed”).visible(true);
}

And it is still the same, is there anything I missed?

For checkbox, try:

if ($(this).is(“:checked”)) { // Checked

ENLIGHTENING! Thank you!

But what syntax should I use if it is a radio? Or, which part should I read in the help file if I want to know more about this?

Ah, I guess for a radio it should be:

if ($(this).value == 0) {
//other codes
}

did some searching, and learn that it should be:

if ($(this).value == “Yes”) {
//other codes
}