Hi,
I am currently trying to update an application I am working on to use
4.1.1 from a previous build, and I've noticed that functions that I've
added to the page via dojo.addOnLoad() are sometimes being fired
before all of the elements on the page are loaded. For example:
dojo.addOnLoad(
function () {
var charCount = $('textArea').getProps().value.length;
$('staticText').setProps({ value : charCount.toString() });
}
);
in a <w:script> tag at the end of the page will cause a javascript
error saying "$('textArea') has no properties" when the page is
loaded. The way I have found to fix this is by changing the above
call to the below:
dojo.addOnLoad(
function init() {
if ($('textArea') && $('staticText')) {
var charCount = $('textArea').getProps().value.length;
$('staticText').setProps({ value : charCount.toString() });
} else {
setTimeout(init, 5);
}
}
);
Before updating to 4.1.1 this worked with the initial function. Is
there some other function that dojo.addOnLoad() that I can use to
ensure that the entire page has been built?
Thanks,
Ryan Burrows