I'm running this script in a custom script box of some workflow software. I want the user to have specific fields hide or show based on the list value. This script is on pages after the user picked the list field value. So this loads on a page where the list field is populated. The script works - it shows and hides the correct fields, BUT it makes the value selected not visible. The field is there, but the value is blank.
I've also tried removing the document.ready function at the beginning. I've tried removing val(function() and putting it all into the if statement.
$(document).ready(function() {
$("#ctl00_mainContent_qtWfInstance_ctl00_ctl01_lstValues").val(function() {
if ($(this).val() == "One") {
$("#CustomFieldWrapper_1277_0_0").show();
$("#CustomFieldWrapper_1303_0_0").hide();
}
if ($(this).val() == "Two") {
$("#CustomFieldWrapper_1303_0_0").show();
$("#CustomFieldWrapper_1277_0_0").hide();
}
});
});
I'm wondering why the list field's selected value doesn't display? The drop down is there, and the list field can be updated (it is editable on the next step). It is showing and hiding correctly based on the value that was selected in the last step.