I am adding the below piece of code to the content page of a portal webpage. I don't
know what is wrong what it wont work on the portal.
I am simply trying to show one field or hide it depending on another field. This code used to work on power app portals but it doesn't seem to be anymore.
$(document).ready(function(){
$("#ahi_bres01q04species").change(SetFieldsVisibilityQ7b);
//$("#ahi_bres01q04species").change();
});
function SetFieldsVisibilityQ7b() {
var selectedValue = $("#ahi_bres01q04species").val();
if (selectedValue !== null && selectedValue === "100000005")
{
$("#ahi_bres01q05mgmtsystem_label").closest("tr").hide().attr('aria-hidden', 'true');
$("#ahi_bres01q05mgmtsystem").prop('required',true).closest("tr").show().attr('aria-hidden', 'false').attr('aria-required', 'true');
}
else
{
$("#ahi_bres01q05mgmtsystem_label").closest("tr").hide().attr('aria-hidden', 'true');
$("#ahi_bres01q05mgmtsystem").prop('required',false).closest("tr").show().attr('aria-hidden', 'false').attr('aria-required', 'false');
}
}