javascript - getElementById returns allways null if i search for new created Element -


i want duplicate 1 element , assign new id , names. aim later want find element again. here example:

<div id="contdiv"> <div style="float:left"> filename </div> <div style="margin-left: 323px"> playtime(in sek.) </div> <div id="tl_einst" class="editor-field"> <select id="medianames" onchange="change(this)" name="tl_medianame"> <span class="field-validation-valid" data-valmsg-replace="true" data-valmsg-    for="filename">    </span> <select id="playtime" class="playtime" name="playtime" disabled=""> </div> <input id="more" type="button" onclick="addfiles()" value="+"> </div>   

in runtime duplicate element "tl_einst" children. user changes content of combox read them , send them server. later answer. call getelementbyid("newelementid"), null, if search new created element. can do?

thank you

marek

the proper syntax is:

var el = document.getelementbyid("newelementid"); 

typically, # jquery or other javascript frameworks, or @quention mentions below, can used document.queryselector.

where adding element dom? include code too?


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -