title: jquery, my variable has 2 values
body: <p>in a page test.php I'm loading content.php like this:</p>
  
  <pre><code>$(document).on('click', '.test', function () {
          $('#content').load('content.php');
  }); 
  </code></pre>
  
  <p>in content.php I have this Jquery code:</p>
  
  <pre><code>$(function() {
     var nb = 10;
     $(document).on('click', '.trigger', function () {
           alert(nb);
           nb +=10;
     });
     $(document).on('click', '.exit', function () { $('#content').html(''); });
  });
  </code></pre>
  
  <p>when I'm clicking for the first time on #content nb as the value 10 and I can increment it by clicking on it, for exemple I'm clicking 3 times on it so its value is 40. Then I'm closing the div by clicking on .exit, and I'm reloading content.php by clicking on #content. Now I have two alert: nb as the value 10 but it also has the value 40, how come it still has the value 40?</p>