title: How to create a anchor link in javascript with dynamic arguments?
body: <p>I am trying to create an anchor link when a user clicks on another link.<br>
  When I click on the first link, the onclick event is raised and generates another link using JavaScript, but that is not generated properly.</p>
  
  <p>This is my anchor link in JavaScript:</p>
  
  <pre><code>temp="&lt;li&gt;&lt;a href='#' onclick='showMenu3('"+menu2[0]+"','"+menu2[2]+"')'&gt;
        &lt;img src='images/noImageSmall.png'/&gt;"+menu2[2]+"&lt;/a&gt;&lt;/li&gt;";
  </code></pre>
  
  <p>But it is generated in the source as following:</p>
  
  <pre><code> &lt;li&gt;&lt;a href="#" onclick="showMenu3(" 139','invite="" a="" friend')'=""&gt;
      &lt;img src="images/noImageSmall.png"&gt;Invite a friend&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>How can I generate the following link using JavaScript?</p>
  
  <pre><code> &lt;li&gt;&lt;a href="#" onclick="showMenu3('139','invite friend')"&gt;
          &lt;img src="images/noImageSmall.png"&gt;Invite a friend&lt;/a&gt;&lt;/li&gt;
  </code></pre>