...

View Full Version : write inside a div



javalame
07-05-2011, 08:43 PM
hey ppl. i am new here. looks like i will do some Js for years
i have a div called "farmacias" inside the content div
i want to write something in the div but this is not working
document.getElementById("farmacias").innerHTML='ola'
anyone knows why?

Philip M
07-05-2011, 08:58 PM
Works for me.


<div id = "container">
<div id = "farmacias">
</div>
</div>
<script type = "text/javascript">
document.getElementById("farmacias").innerHTML='ola'
</script>

Are you sure that the <div> exists at the time the script executes?


You were so far up Jim's behind, you couldn't see the wood for the trees. - Presenter BBC1



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum