user3024007
user3024007

Reputation: 283

Dynamically constructed variable (jQuery syntax)

I'm trying to construct global vars inside of jQ .each(). I get 'invalid left-hand side in assignment' error...

'prefix_' + $(this).attr('id') = $(this).method();

Upvotes: 0

Views: 19

Answers (1)

bagonyi
bagonyi

Reputation: 3328

window['prefix_' + $(this).attr('id')] = $(this).method();

Upvotes: 2

Related Questions