user2855120
user2855120

Reputation: 21

Error in creating links using dojo

Kindly help me in creating a link using Dojo,,Both programmatic and declarative way I tried the following Code,but i am unable to get the output

<script>dojoConfig = {parseOnLoad: true}</script>
        <script src='dojo/dojo.js'>
        require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win){
  domConstruct.create("a", { href: "foo.html", title: "Goto FOO!", innerHTML: "link" }, dojo.body());
});

Upvotes: 0

Views: 112

Answers (1)

mbulman
mbulman

Reputation: 470

The javascript itself should work just fine: http://jsfiddle.net/yXmBT/

It looks like you're trying to include a remote js resource and inline code in the same script tag though, which doesn't work (only the remote resource will be executed).

You'll want:

<script src='dojo/dojo.js'></script>
<script>
    require(["dojo/dom-construct", "dojo/_base/window"], function(domConstruct, win){
        domConstruct.create("a", { href: "foo.html", title: "Goto FOO!", innerHTML: "link" }, dojo.body());
});
</script>

Upvotes: 3

Related Questions