javascript - How do I give an id to an appended element? -


the 1 i'm talking 1 have code appear literally, string. how combine actual code, <div id="thing">string goes here</div>?
i've tried making div , id part of content inside (' ') doesn't work. when that, content never gets appended.

here's code:

$('#placetoappendto').append ('&lt;br&gt;&lt;div&gt;&lt;input&nbsp;type="text"&nbsp;class="textfield"&nbsp;id="text'+textclicked+'"&lt;/div&gt;'); 

to html presented, this:

var elem = document.createelement('div'); elem.id = "thing"; elem.appendchild(document.createtextnode("string goes here")); 

i hope helps, since question isn't particularly clear.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -