title: Javascript special escaping characters
body: <p>Hi I am using JavaScript function that is called from an anchor link which passes a title that has a special character could you please tell me how can I escape the single quote in the string passed to the function.</p>
  
  <p>The sample string is given below,</p>
  
  <pre><code>string desc="test's/test2'w";
  </code></pre>
  
  <p>sample link html</p>
  
  <pre><code>"&lt;a href="javascript:getdata(\'' + desc+ '\',);void(0);"&gt;TEST&lt;/a&gt;"
  </code></pre>
  
  <p>so the function <code>getdata</code> is not called since it's not escaping that character.</p>
  
  <p>Its a legacy system I will need to work with HTML only</p>