title: ReferenceError: Can't find variable in function JS
body: <p>I have this code:</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"&gt;&lt;/script&gt;
  
  
  var newPoint = "&lt;div class='item-point' data-top='" + cY + "' data-left='" + cX + "' id='point" + random + "'&gt;" +
  "&lt;div&gt;" +
  "&lt;a onclick='test(1);' target='_blank' href='" + url + "'  class='toggle tooltips' title='" + description + "'  data-placement='top' data-html='true' rel='tooltip'&gt;&lt;span class='pointFormat'&gt;" + pointCount + "&lt;/span&gt;&lt;/a&gt;" +
  "&lt;/div&gt;" +
  "&lt;/div&gt;";
  
  $(".scalize").append(newPoint);
  
  
  &lt;div class="scalize"&gt;&lt;/div&gt;
  
  function test(variable) {
     alert(variable);
  }
  </code></pre>
  
  <p>and it's not working. I have error: ReferenceError: Can't find variable: variable.</p>
  
  <p>I have error when I click on link (a href)</p>
  
  <p>How to repair it?</p>