title: Having issues on if-else statement on the text changed event
body: <p>I have a little bit issue here on my html text changed event in regards with my if-else statement. Here's the scenario, I have the html layout below which has a dropdown list of all locations. Now, if type in your location on the input text box which has id of <strong>"#searchloc"</strong> it will query as you typed in and rebind the record list on the <strong>"#dropdownlist"</strong> div element. So my problem is, I want to rebind the <strong>"#dropdownlist"</strong> div element back to its default which shows all locations once I clear back or empty the <strong>"#searchloc"</strong> input textbox but the <strong>"#dropdownlist"</strong> div element remained clear or empty. Below I tried to use if-else statement to do this but I notice that under the <strong>else{...}</strong> statement it won't fire the function or even the alert method. How do I handle this type of issue in jquery?</p>
  
  <p><strong>HTML Layout:</strong></p>
  
  <pre><code>&lt;input type="text" id="searchloc" class="searchloc" onchange = "QueryLocation();" onkeydown="this.onchange();" onkeyup="this.onchange();" onkeypress = "this.onchange();" oninput = "this.onchange();" placeholder="Search Location"  /&gt;
  
     &lt;div id="dropdownlist" data-bind="foreach: PopulateAllLocation" &gt;
  
      &lt;div id="alllocationdiv" &gt; &lt;label id="listlocation" class="listlocation" data-bind="text: CityTown"&gt;&lt;/label&gt;&lt;/div&gt;   
  
   &lt;/div&gt;
  </code></pre>
  
  <p><strong>jQuery:</strong></p>
  
  <pre><code>// Change the dropdownlist result as text input change
      function QueryLocation() {
          if ($("#searchloc").val() != null) {
              var dataObject = {
                  CityTown: $("#searchloc").val()
              };
              $.ajax({
                  url: '/OnlineStore/SearchLocation',
                  type: 'GET',
                  contentType: 'application/json; charset=utf-8',
                  data: dataObject,
                  dataType: 'json',
                  success: function (data) {
                      self.PopulateAllLocation(data);
                  },
                  error: function () {
                      console.log('err')
                  }
              });
          }
          else {
  // Under this else statement won't fire any of this function...???
               DisplayLocations();
              alert("Textbox is empty...");
  
          }
  
      }
  </code></pre>