title: Code works with alert but not without
body: <p>The problem I am encountering is that when I add the <code>alert command</code> the code works, but if I remove it, it does not work. Very strange. </p>
  
  <p><strong>How can I make it work without <code>alert command</code>?</strong> </p>
  
  <p>The code below works with <code>alert</code>, but not without. </p>
  
  <pre><code>  $(function(){ 
                      $('.page-links').click(function() {
                        $('#page').load('page' + $(this).data('target') + '.html');
                      }); 
  
      $('[data-target]').on('click', function() {
           var NavigationNumber = $(this).attr('data-target'); 
  
  
              // If and if only page18 is clicked, run diagram18.js
              if (NavigationNumber == 18) {
                  alert(NavigationNumber);
                  // Run diagram18.js
                      $.getScript("SensorTables/diagram" + NavigationNumber + ".js", function() {
                          window['diagram' + NavigationNumber]();
                      });
      });
  
   });
  </code></pre>