What is the Dojo equivalent to $("...").text("asdf")
and $("...").text()
?
Also is there a wiki or site that provides dojo equivalents of jQuery functions?
A similar function in dojo is NodeList.text()
http://dojotoolkit.org/reference-guide/1.7/dojo/NodeList-manipulate.html#text
You can use like below.
dojo.query("#id").text("asdf");
var txt = dojo.query("#id").text();
You are looking for the dojo/dom-prop module. If you look at the source, there is special handling for the textContent property if the current browser does not support it.
if(propName == "textContent" && !has("dom-textContent")) {
ctr.empty(node);
node.appendChild(node.ownerDocument.createTextNode(value));
return node;
}
Your code would look like the following:
domProp.set(node, "textContent", "hello world!");
or
domProp.get(node, "textContent");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With