1

I learn jquery not long time. Help please to put variable instead object method.

return {
    label: item.MYVariable,
}

I need instead of MYVariable put dynamic variables.

0

1 Answer 1

2

Assuming I've understood your question correctly, you can use bracket notation to access the variables, like this:

var foo = 'MYVariable';
return {
    label: item[foo];
}
Sign up to request clarification or add additional context in comments.

Comments

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.