Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-05-2011, 08:43 PM   PM User | #1
javalame
New to the CF scene

 
Join Date: Jul 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
javalame is an unknown quantity at this point
write inside a div

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?
javalame is offline   Reply With Quote
Old 07-05-2011, 08:58 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,044
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Works for me.

Code:
<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
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:09 AM.


Advertisement
Log in to turn off these ads.