I'm still a total noob. But I am trying something and I was hoping someone could help me. I have a very simple idea. I've been researching it but I am so green that I don't seem to be asking the right questions so I thought I'd come to the experts.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<div class="footer"> </div>
$('.footer').html('<p>This is the Footer</p>');
I thought that the because the html doc (seen above) calls the .js it would automatically (magically) find the footer class and insert the html. Clearly I am wrong. I am looking it up over at w3schools but I would appreciate any enlightenment anyone could offer. Please be kind, I really am new at this...
Try putting your script call in the body after the div tag with the Class = 'footer'
May also need an id assignment of 'footer'
Last edited by JMRKER; 06-24-2012 at 09:21 PM.
Is it necessary to have a script call? I assumed that the external style sheet could "find" the div tag based upon class = or id =
It's not a call. I wanted you to move the external reference access.
Originally Posted by chartoonz
As to your reply (and thanks by the way) I am not sure I follow are you saying I should source the script down in the div and not up in the head? What if I want to eventually grow the script and do other things with it..?
Because you have the external reference in the head tag,
It is loading before the 'footer' element has been created.
The error is because it is not available to the script
Because it has not finished loading the HTML code
Try moving the whole <script ...> info to after the <div ...> tag
And before the </body> tag
yeah I ended up linking in jquery and using the .ready. It's working now.
overkill wasn't the issue... functionality was. At least I got it working...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)