Get element using id problem
Posted
by
Ebe
on Stack Overflow
See other posts from Stack Overflow
or by Ebe
Published on 2009-05-15T15:50:58Z
Indexed on
2013/07/01
10:21 UTC
Read the original article
Hit count: 221
JavaScript
|dom
I am modifying existing legacy webpages(which i shouldn't modify existing parts but adding) and the webpage uses document.write to write certain html elements. when i use
<script type="text/javascript" language="javascript">
var v = document.getElementById('td_date_cal_0');
alert(v);
</script>
v becomes null and when i create button and click
<input type="button" id="mnbutton" onclick="mnLoader();" value="Click Me!" />;
<script type="text/javascript" language="javascript" >
function mnLoader() {
var v = document.getElementById("td_date_cal_0");
alert(v);
} <br />
</script>
Any idea, how to get the element without need of user action, such as clicking?
Thanks, Ebe
© Stack Overflow or respective owner