0

The code breaks on the first [. The uniqueid is a variable.

function() {            
    ['fg'+uniqueid].setPagination();
}

I know the [] method can be used for variables in object names, but apparently not when the variable is the first in line? Anyone an idea what's the correct method?

1 Answer 1

4

For bracket notation, you need the parent object, even if it's window, like this:

window['fg'+uniqueid].setPagination();

Or, if it's something else:

myObject['fg'+uniqueid].setPagination();

Or relatively:

this['fg'+uniqueid].setPagination();
Sign up to request clarification or add additional context in comments.

1 Comment

Great, the window method works great! The other two methods don't work in my code. Thanks for the great and quick help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.