I have some code which i've got which hides 2 SharePoint fields based on the values of the said fields. The code is below:

I have 2 fields. 'Service Lead Approved?' and Funding Request Sanctioned?. Both are boolean fields.
The code checks to see if the values of 2 fields are set to specific values and then hides either one or both fields from view dependant on their values.

Everything works as normal for 2 of the 3 outcomes.

IF 'Service Lead Approved?' and Funding Request Sanctioned? both equal 'NO', then Funding Request Sanctioned? is hidden.

IF 'Service Lead Approved?' equals 'YES' and Funding Request Sanctioned? equals 'NO', then Funding Request Sanctioned? is hidden.

However, when 'Service Lead Approved?' and Funding Request Sanctioned? both equal 'YES', then 'Service Lead Approved?' IS hidden but Funding Request Sanctioned? is not. In my code, both fields should be hidden and I cannot see why this isn't working.

Any help would be greatly appreciated.


Code:
<!-- SECTION 4.0: SHOW/HIDE 'SERVICE LEAD APPROVED'/'FUNDING REQUEST SANCTIONED?' OPTIONS -->
// since we will be accessing the collection of nobr elements multiple times,
// let's cache the collection for performance.
var nobr;
// define globally, set in document ready function (see below)

function showConditionalRows() {
      var okToShow = true;
      var hideALL = true;
      if ($("select[title='Service Lead Approved?']").val() == "Yes" && $("select[title='Funding Request Sanctioned?']").val() == "Yes") {
            hideALL = false;
      }
      else if ($("select[title='Service Lead Approved?']").val() == "No" && $("select[title='Funding Request Sanctioned?']").val() == "No") {
            okToShow = false;
      }
      else if ($("select[title='Service Lead Approved?']").val() == "Yes" && $("select[title='Funding Request Sanctioned?']").val() == "No") {
            okToShow = false;
      }
      // set up an array with the display names of the conditional fields
      var titles1 = ['Funding Request Sanctioned?'];
      var titles2 = ['Funding Request Sanctioned?','Service Lead Approved?'];
      for (var i = 0; i < titles1.length; i++) {
            nobr.filter(":contains('" + titles1[i] + "')").closest("tr").toggle(okToShow);
      }
      for (var i = 0; i < titles2.length; i++) {
            nobr.filter(":contains('" + titles2[i] + "')").closest("tr").toggle(hideALL);
      }
}
$(document).ready(function() {
      // initialize global vars
      nobr = $("nobr");
      showConditionalRows();
      $("select[title='Service Lead Approved?'], select[title='Funding Request Sanctioned?']").change(function() {
            showConditionalRows();
      });
});