title: How to pass string in Javascript function dynamically
body: <p>I have a javascript function like this </p>
  
  <pre><code>function doIt(link) {
      alert(link);
  }
  </code></pre>
  
  <p>And i call this function in below given JS code, where i am creating an a tag and appending it to my html page on runtime:</p>
  
  <pre><code>jQuery.each(data, function (i, val) {
      var card = '&lt;a href="Views/NewsDetail.html" onclick=" doIt(' + val.Img + '); "&gt; \
                  &lt;div class=" card"&gt; \
                  &lt;img src='+ val.Img + ' /&gt; \
                  &lt;p&gt;'+ val.Title + '&lt;/p&gt; \
                  &lt;/div&gt; \
                  &lt;/a&gt;';
      document.getElementById('News').innerHTML += card;
  });
  </code></pre>
  
  <p>Say for example our <code>val.Img = 'abcd'</code>
  When i click the a tag it calls <code>doIt(abcd)</code>, but i want to call <code>doIt('abcd')</code> passing it as string.</p>
  
  <p>Is there any workaround for this.</p>