title: Store html code to javascript variable
body: <p>I have a problem when converting store html code to javascript variable, I know we can convert using converter tools, but I can't use this converter in my situation.</p>
  
  <p>I am trying the following code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var t_cls="font-effect-anaglyph rotator";
  var randompostsurl="www.allinworld99.blogspot.com";
  var randompoststitle="Open Inspect Element And see the Code";
  var default_script = "&lt;script&gt; document.write('&lt;div&gt;&lt;a  class="+t_cls+" href=\"' + randompostsurl + '\" rel=\"nofollow\"&gt;' + randompoststitle + '&lt;\/a&gt;&lt;\/div&gt;'); &lt;\/script&gt;\n";
  
  $("#apnd").append(default_script);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;div id="apnd"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The above one will produce the following <strong>output</strong></p>
  
  <pre><code>&lt;a class="font-effect-anaglyph" rotator="" href="www.allinworld99.blogspot.com" rel="nofollow"&gt;Open Inspect Element And see the Code&lt;/a&gt;
  </code></pre>
  
  <p>Why the rotator class will created as new attribute?</p>