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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -