Starting with Dojo (v 1.7.4)

by b_long

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.4/dojo/resources/dojo.css">
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.7.4/dijit/themes/claro/claro.css">
<!-- note that you can always create a dojoConfig object instead of putting everything into data-dojo-config if you want -->
<div class="claro">
    	<h3>Demo: Custom Modules with CDN</h3>

    <button id="welcomeButtonNode" type="button">Click me!</button>
    <br/>
    <div id="welcomeMsgBoard"></div>
</div>

JavaScript

// load our custom/Hello module and wait for the DOM to be ready
require(["dojo/ready", "dijit/form/Button", "dojo/dom", "dijit/Dialog"], function (ready, Button, dom) {
    ready(function () {
        // Create a button programmatically:
        var myButton = new Button({
            label: "Click me!",
            onClick: function () {
                // Do something:
                dom.byId("welcomeMsgBoard").innerHTML += "Welcome to Dojo! " + "<br/>";
            }
        }, "welcomeButtonNode");
    });
});