pfdevilliers
pfdevilliers

Reputation: 284

Dojo not working for me

I can't get my dojo working. I've tried everything.

Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js">


    dojo.addOnLoad(function(){
    console.log("page ready, can modify DOM anytime after this");

});
</script>

</head>
<body>

</body>
</html>

Upvotes: 2

Views: 2240

Answers (1)

Sean Vieira
Sean Vieira

Reputation: 159855

Take your code and put it in another script tag after the dojo script tag:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js"></script>
<script type="text/javascript">
dojo.addOnLoad(function(){
    console.log("page ready, can modify DOM anytime after this");
});
</script>

A script tag with an src attribute cannot also contain code, unless you use a John Resig-like hack.

Upvotes: 6

Related Questions