title: Javascript - prompt keeps coming back after Ok is pressed
body: <p>I have the following JavaScript configuration. It works well when it loads and keeps working well the first time I click on the button with id <code>buttonKernel</code>. This should run the function <code>onPageLoad</code>, which resets a grid presented on screen and reload the event handlers. The second time I click the button thought, after clicking OK on the prompt, it keeps prompting again. If I insist, it will eventually work. 
  I'm new to JavaScript, so that I don't know if this self calling function can be at the root of the problem. </p>
  
  <pre><code> $(document).ready(function(){
      onPageLoad(16);
  });
  
  function onPageLoad(size){
      genDiv(size);
      $('.gridSquare').hover(function(){
          $(this).css('background-color', 'red');
      });
      $('#buttonKernel').click(function(){
          $(".gridSquare").css('background-color', 'yellow');
  
          var input = prompt ("Enter a size for the grid", "16");        
          size = checkInp(input);
          var list = document.getElementsByClassName("row");
          for (var i = list.length - 1; 0 &lt;= i; i--)
          {
              if (list[i] &amp;&amp; list[i].parentElement)
              list[i].parentElement.removeChild(list[i]);
          };  
          onPageLoad(size);
      });
  }
  </code></pre>