1

How can I use a string variable as an object name in jQuery?

var elem = "objectName";

...to be used in a similar fashion to...

var opts = $.nt.elem.options;

I tried var opts = $.nt[elem]options; to no avail.

Any ideas?

1 Answer 1

2

You've missed a dot in var opts = $.nt[elem].options;

Sign up to request clarification or add additional context in comments.

1 Comment

Ah. Good catch. I tried dots on both sides, but not just on the right. Thank you!

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.