public/app.js
// Define function that fires when the clear query button is clicked.
Define function that fires when the clear query button is clicked.
Define function that fires when the clear query button is clicked .
function onClickEventBehaviorOfClearQueryButton(event)  
  {
    event.preventDefault();
    let templateTarget = document.querySelector(".formWrapper");
    templateTarget.innerHTML = ""; 
    loadQueryForm();
    document.querySelectorAll(".fieldToOrderBy")[0].addEventListener("change", onChangeBehaviorForFieldToOrderBySelector);
    document.querySelectorAll(".fieldToDisplay")[0].addEventListener("change", onChangeBehaviorForFieldToDisplaySelector);
    document.querySelectorAll(".conjunctionSelector")[0].addEventListener("change", onChangeBehaviorForConjunctionSelector);    
    document.querySelectorAll(".orderByConjunctionSelector")[0].addEventListener("change", onChangeBehaviorForOrderByConjunctionSelector);
  }
function onClickEventBehaviorOfClearQueryButton ( event ) { event . preventDefault ( ) ; let templateTarget = document . querySelector ( ".formWrapper" ) ; templateTarget . innerHTML = "" ; loadQueryForm ( ) ; document . querySelectorAll ( ".fieldToOrderBy" ) [ 0 ] . addEventListener ( "change" , onChangeBehaviorForFieldToOrderBySelector ) ; document . querySelectorAll ( ".fieldToDisplay" ) [ 0 ] . addEventListener ( "change" , onChangeBehaviorForFieldToDisplaySelector ) ; document . querySelectorAll ( ".conjunctionSelector" ) [ 0 ] . addEventListener ( "change" , onChangeBehaviorForConjunctionSelector ) ; document . querySelectorAll ( ".orderByConjunctionSelector" ) [ 0 ] . addEventListener ( "change" , onChangeBehaviorForOrderByConjunctionSelector ) ; }
Define function that fires when the clear query button is clicked.
Define function that fires when the clear query button is clicked .
// Stop it from redirecting anywhere // Remove the old query form if any from the webpage. // Call the loadQueryForm function above to load a new clean queryForm onto the webpage. // Now add back the onChange event listeners for the controls on the form.