title: How to use PHP echo in onclick, multiple times
body: <p>I'm trying to add some php into onclick button</p>
  
  <p>This works fine:</p>
  
  <pre><code>&lt;a onclick="welcomeDiv(welcomeDiv6);"&gt;&lt;/a&gt;
  </code></pre>
  
  <p>However if I try this:</p>
  
  <pre><code>echo '&lt;a onclick="welcomeDiv(welcomeDiv'.$cols.');"&gt;&lt;/a&gt;';
  </code></pre>
  
  <p>It doesn't work, error: <code>TypeError: div is null</code>. It's weird because the $cols works.</p>
  
  <p>Also for multiple elements:</p>
  
  <pre><code>echo '&lt;a onclick="
    document.getElementById("iframeHolder'.$cols.'").src=
    "'.JRoute::_(SEO::getItemRoute($i-&gt;id.':'.$i-&gt;alias,$i-&gt;cat_id.':'
      .$i-&gt;c_alias))
      .';welcomeDiv("welcomeDiv'.$cols.'");""
    &gt;&lt;/a&gt;';
  </code></pre>