public/app.js
// Define the function that fires when the fieldToOrderBy selector changes.
Define the function that fires when the fieldToOrderBy selector changes.
Define the function that fires when the fieldToOrderBy selector changes .
function onChangeBehaviorForFieldToOrderBySelector (event)  
  {
    event.preventDefault();
    let selectorElementValues = [];
    document.querySelectorAll(".fieldToOrderBy").forEach(function(element) 
    {
      if(element.value != "")
      {
        selectorElementValues.push(element.value);
      }
    });   
    document.querySelectorAll(".fieldToOrderBy").forEach(function(element) 
    {
      let optionElements = element.querySelectorAll('option');  
      for (let optionElement of optionElements) 
      {
        if(selectorElementValues.indexOf(optionElement.innerHTML) > -1)
        {
          optionElement.style.display = "none";
        }    
        else
        {
          optionElement.style.display = "list-item";
        }  
      }
    }); 
  } 
function onChangeBehaviorForFieldToOrderBySelector ( event ) { event . preventDefault ( ) ; let selectorElementValues = [ ] ; document . querySelectorAll ( ".fieldToOrderBy" ) . forEach ( function ( element ) { if ( element . value != "" ) { selectorElementValues . push ( element . value ) ; } } ) ; document . querySelectorAll ( ".fieldToOrderBy" ) . forEach ( function ( element ) { let optionElements = element . querySelectorAll ( 'option' ) ; for ( let optionElement of optionElements ) { if ( selectorElementValues . indexOf ( optionElement . innerHTML ) > - 1 ) { optionElement . style . display = "none" ; } else { optionElement . style . display = "list-item" ; } } } ) ; }
Define the function that fires when the fieldToOrderBy selector changes.
Define the function that fires when the fieldToOrderBy selector changes .
// Stop it from redirecting anywhere // Start of: Hide options which contain fields that are already displayed on select elements. // 1. Create an empty array to hold the values contained in the select elements. // 2. Look at each select element and store their values in the array. // if the select elements are not blank // Push the values onto the array. // 3. Examine the menu options of the selector having focus and hide any  //    options that exist in the selectElementValues array. //    So if an item has already been selected then it won't show in the  //    list of items to select. // End of: Hide options which contain fields that are already displayed on select elements. // End of: function onChangeBehaviorForfieldToOrderBySelector (event)