title: Using JavaScript single and double quotes for href's
body: <p>I am having problem with escaping the single and double quotes inside the <code>href</code>s JavaScript function. </p>
  
  <p>I have this JavaScript code inside <code>href</code>. It's like -</p>
  
  <pre><code>&lt;a href = "javascript:myFunc("fileDir/fileName.doc", true)"&gt; click this &lt;/a&gt;
  </code></pre>
  
  <p>Now, since double quotes inside double quote is not valid, I need to escape the inner double quotes for it to be treated as part of the string - 
  so, I need to do this -</p>
  
  <pre><code>&lt;a href = "javascript:myFunc(\"fileDir/fileName.doc\" , true)"&gt; click this &lt;/a&gt;
  </code></pre>
  
  <p>The problem is, even the above code is not working. The JavaScript code is getting truncated at --  <code>myFunc(</code></p>
  
  <p>I tried with the single quote variation too - but even that doesn't seem to work (meaning that if I have a single quote inside my string literal then the code gets truncated).</p>
  
  <p>This is what I did with a single quote:</p>
  
  <pre><code>&lt;a href = 'javascript:myFunc("fileDir/fileName.doc" , true)'&gt; click this &lt;/a&gt;
  </code></pre>
  
  <p>This works, but if I have a single quote inside the string then the code gets truncated in the same way as that of double quotes one.</p>