[Dojo-interest] Working with Dojo DOM functions

theguyver manueldeleon at gmail.com
Tue Aug 9 01:42:50 EDT 2011


I'm playing with the first example on 
http://dojotoolkit.org/documentation/tutorials/1.6/dom_functions/ Dojo DOM
Functions  but I'm not getting the expected result. Here's my code:

  var setText = function(node, text) {
    node = dojo.byId(node);
    return node.innerHTML = text;
    };
    
  dojo.ready(function() {
    var one = dojo.byId("one");
    setText(one, "One has been set");
    return setText("two", "Two has been set as well");
  });

Even though I don't get any errors, the list isn't changed. I was expecting
the first two items to change their text. Can someone please explain why the
previous code doesn't work but the following does?

function setText(node, text){
    node = dojo.byId(node);
    node.innerHTML = text;
}
 
dojo.ready(function(){
    var one = dojo.byId("one");
 
    setText(one, "One has been set");
    setText("two", "Two has been set as well");
});


Thanks in advance for your help,

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Working-with-Dojo-DOM-functions-tp3237921p3237921.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.


More information about the Dojo-interest mailing list