user1739825
user1739825

Reputation: 820

Simple dojo example Error: this.domNode is null

Referring to jsFiddle's [code][1] by CSWING, why does this indicate "TypeError: this.domNode is null (26 out of range 15) in dojo.js".

Here is my code copied from CSWING, for learning and testing,

<!DOCTYPE html>
<html>
 <head>
  <style>
    html, body /*standard layout for every dojo webpage*/
  {
    width: 100%;
    height: 100%;
    padding: 0px;
    margin: 5px;
    overflow: hidden;/*no scrollbar used*/
  }

#standby {
    position: absolute;
    top: 50%;
    left: 50%;
    width:32px;
    height:32px;
    margin-top: -16px;
    margin-left: -16px;
   /*
    width: 300px;
    height: 300px;
    background-color: #e7e7e7;
   */
}

</style>
<link rel="stylesheet" href="../dojo1_8/dijit/themes/claro/claro.css">
<script>dojoConfig = {parseOnLoad: true}</script>
<script src="../dojo1_8/dojo/dojo.js"></script>

</head>
<body class="claro">
<div id="standby">    
<div id="btn" data-dojo-type="dijit.form.Button" data-dojo-props="label:     
Go'"></div>    
</div>

<script>
require(["dojox/widget/Standby","dijit/form/Button",
"dojo/store/Memory",'dijit/form/ComboBox',
"dojo/on", "dojo/domReady!"],
function(Standby, Button, Memory, on, ComboBox)
{       
    var standby = new Standby
    ({
           id: "standbyObj",
       target: "btn",
        color: "transparent",
       zindex: "auto",
     duration: "1000"
    });
dojo.body().appendChild(standby.domNode);
standby.startup();

on(dojo.byId('btn'), 'click', function() 
{
    standby.show();

  //simulate a request.  hide the timeout in 5 seconds
 setTimeout(function()
{
    standby.hide(); 
    }, 5000);
   });
   });
   </script>
   </body>
</html>

Please advise. Thanks clement [1]: http://jsfiddle.net/cswing/253Te/

Upvotes: 0

Views: 870

Answers (1)

Craig Swing
Craig Swing

Reputation: 8162

Looking at my original fiddle, I believe that

dojo.byId('btn')

should be

dijit.byId('btn')

If that doesn't solve your problem, then I would set firebug to Break on Errors. When the error occurs, look at the stack trace to find more information about where the error is coming from and what might be causing it.

Upvotes: 1

Related Questions