Appending new element to existing one Jquery & Javascript -


I am trying to add some elements to an existing DOM element but failed.

Here's what I tried

Method first

  $ ('# b-friend-selector'). Attachment ('& lt; script type = "article / fbml">    

This resonates ) on my code

If I & lt; Script & gt; I delete the tag with this string showing this error in my browser console unterminated string .

In addition to that I have tried to insert a string in a single string JS error and still printing ) the second one with javascript on my web page

  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. RequestForm.setAttribute ('invite', 'true'); requestForm.setAttribute ('type', 'test'); requestForm.setAttribute ('align', 'leave'); setAttribute ('method', 'post'); requestForm.setAttribute ; RequestForm.setAttribute ('content', 'testems & lt; fb: req-choice url =' http: //www.facebook.com/apps/application.php? Id = xxxxxxx / request 'label =' accept '/ & Gt; "); Var Multi Seal = 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 ('column', "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 (multiple selection);   

Can you suggest tips in a smarter way?

requires multilevel strings

You can try it one, but perhaps The problem is that you can not escape from it and if your file is not parsed by PHP (like .js or .html) <('& lt; script type = "text / fbml" & gt; & Lt; / script & gt; '). Html ('& lt; fb: fbml & gt; & lt; fb: request-form \ action = "http: //

Comments