DOM has not loaded | What to do?

rasengan_sensei

New Member
The PHP snippet in the code below creates a div with id universals.However in the javascript further down when I try to access this value I get null. Obviously the PHP is generated server side. So I would have thought that the data would be available by the time the script runs on the client.What can I do to fix?\[code\]<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content='text/html; charset=utf-8' http-equiv='Content-Type'> <meta name='description' content='Foo - All Your Bookmarks in One Place.'> <meta name='description' content='A better way to bookmark.'> <link rel="Shortcut Icon" href="http://stackoverflow.com/questions/12751458/foo/images/logo_small.ico" /> <title>Arcmarks</title> </head> <body id="body"> <?php include 'class.SUniversals.php'; $o = new SUniversals(); $o->sync(); ?><!-- produces<div id='universals' data-path='/develop/' data-load='1'></div>--> <noscript>You must have JavaScript turned on to use this application. </noscript> <script> (function (window) { "use strict"; var document = window.document, DEBUG = false, VERSION = (Math.round((new Date()).getTime() / 1000)), PATH = document.getElementById('universals').getAttribute('data-path'); // returns null ....\[/code\]
 
Back
Top