Hide/Show field on select (v2022)

I’m a total jquery newbie, I have searched for examples on this forum and the closest I have found is this:
Hide Form fields based on condition - #4 by vintoICT is my code currently, but it does nothing:

$("#x_fk_ApplicationType").change(function() {
    if (this.value == "1"){ 
                            $(this).fields("Trainer").visible(true); // true to show, false to hide
                            $(this).fields("Files").visible(true); // true to show, false to hide
                            $(this).fields("URL").visible(true); // true to show, false to hide
                            $(this).fields("Location").visible(true); // true to show, false to hide
                            $(this).fields("Cost").visible(true); // true to show, false to hide
                            $(this).fields("DuringWork").visible(true); // true to show, false to hide
                            $(this).fields("LevelTraining").visible(true); // true to show, false to hide
			    $(this).fields("Agreement").visible(true); // true to show, false to hide
                            $(this).fields("Participants").readonly(true);
                        }        
                if (this.value == "2"){ 
                            $(this).fields("Trainer").visible(false); // true to show, false to hide
                            $(this).fields("Files").visible(false); // true to show, false to hide
                            $(this).fields("URL").visible(false); // true to show, false to hide
                            $(this).fields("Location").visible(false); // true to show, false to hide
                            $(this).fields("Cost").visible(false); // true to show, false to hide
                            $(this).fields("DuringWork").visible(false); // true to show, false to hide
                            $(this).fields("LevelTraining").visible(false); // true to show, false to hide
    			    $(this).fields("Agreement").visible(false); // true to show, false to hide
                            $(this).fields("Participants").readonly(true);
                        }
                if (this.value == "3"){
                            $(this).fields("Trainer").visible(true); // true to show, false to hide
                            $(this).fields("Files").visible(true); // true to show, false to hide
                            $(this).fields("URL").visible(true); // true to show, false to hide
                            $(this).fields("Location").visible(true); // true to show, false to hide
                            $(this).fields("Cost").visible(true); // true to show, false to hide
                            $(this).fields("LevelTraining").visible(true); // true to show, false to hide
    			    $(this).fields("Agreement").visible(true); // true to show, false to hide
                            $(this).fields("DuringWork").visible(false);
                            $(this).fields("Participants").disabled(false);
            }
});
$("#x_fk_ApplicationType").trigger("change");
};