Hi All,
Does anyone know of a way that I can set the .text value of a variable element?
I determine the element name but when I use it to set the .text I get an “property undefined error”
// This works
elements["btn_Abbey"].text = "Hello";
// undefined property text
cElement = "btn_Abbey";
elements[cElement].text = "Hello";
Anyone any thoughts?
Thanks
Caroline
Do you have declare cElement with var ?
Gianluca
Try this:
var cElement = “btn_Abbey”
var oElement = elements[cElement]
oElement.text = “Hello”
Gianluca
Many thanks Gianluca that works, it does however still appear as a warning in the code which is a little annoying but I can certainly live with it.
It may be convenient to use the JSDoc to remove the alert.
I’m glad to essert helpful.