Appending new element to existing one Jquery & Javascript
<p>I am trying to add some elements to the existing DOM element but failed.</p>

<p>Here is what I tried </p>

<p>Method First</p>

<pre><code>$('#b-friend-selector').append('&lt;script type="text/fbml"&gt;
   &lt;fb:fbml&gt;
      &lt;fb:request-form
           action="http://&lt;?php echo $_SERVER[\'HTTP_HOST\']?&gt;/"
           target="_top"
           method="POST"
           invite="true"
           type="test"
           align="left"
           content="I am a member of &lt;fb:req-choice url=\'http://www.facebook.com/apps/application.php?id=xxxxxx/requests\' label=\'Accept\' /&gt;" &gt;       
           &lt;fb:multi-friend-selector
        showborder="false"
        actiontext="Select your friends and invite them"
        eail_invite="false"
        cols="4"
        max="32"
        import_external_friends="false"&gt;
         &lt;/fb:request-form&gt;
        &lt;/fb:fbml&gt;
    &lt;/script&gt; '/*It is echoing next contents blindly*/ );
</code></pre>

<p>It is echoing <code>);</code> on my web page.</p>

<p>If I remove <code>&lt;script&gt;</code> tag from this string it is showing error in my browser console <code>unterminated string</code>.</p>

<p>Also I tried putting this string in single line no js error and still printing <code>);</code> on my web page.
Second one with javascript</p>

<pre><code> var script = document.createElement( 'script' );
 script.setAttribute('type',"text/html");
 var fbml=document.createElement('fb:fbml');
 var requestForm=document.createElement('fb:request-form');
 requestForm.setAttribute('action',"http://&lt;?php echo $_SERVER['HTTP_HOST'];?&gt;");
 requestForm.setAttribute('target',"_top");
 requestForm.setAttribute('method',"post");
 requestForm.setAttribute('invite',"true");
 requestForm.setAttribute('type',"Test");
 requestForm.setAttribute('align',"left");
 requestForm.setAttribute('content',"testmes&lt;fb:req-choice url='http://www.facebook.com/apps/application.php?id=xxxxxxx/requests' label='Accept' /&gt;");
 var multiSelect=document.createElement('fb:multi-friend-selector');

 requestForm.setAttribute('showborder',"false");
 requestForm.setAttribute('actiontext',"Select your friends and invite them");
 requestForm.setAttribute('email_invite',"false");
 requestForm.setAttribute('cols',"4");
 requestForm.setAttribute('max',"32");
 requestForm.setAttribute('import_external_friends',"false");
 var main= document.getElementById('b-friend-selector');
 main.appendChild( script );        
 script.appendChild( fbml );
 fbml.appendChild( requestForm );
 requestForm.appendChild( multiSelect );
</code></pre>

<p>Could you suggest an efficient way?</p>
