I am trying to set a field show/hide, required/not required based on the value populated in a multiselect field. The code works fine when the field is a single drop down. Code is being entered into power custom javascript on portal form. Any advice welcome.
$(document).ready(function() {
$("#replacement").click(SetFieldsVisiblityQB6);
$("#replacement").click();
});
function SetFieldsVisibilityQB6() {
var selectedValue = $("#replacement").val();
if (selectedValue != null && selectedValue == "100000001")
{
$("#boughtin_label").closest("tr").show();
$("#boughtin").prop("required",true).closest("tr").show();
}
else
{
$("#boughtin_label").closest("tr").hide();
$("#boughtin").prop("required",false).closest("tr").hide();
}
}