Reputation: 320
I need to do something like this:
$('#online-order').wcForms({id: '#online-order', to: 'contact', colors['red']: '#00F' });
But there is mistake in syntax. Please, tell me how i must pass it. Thanks!
Upvotes: 1
Views: 190
Reputation: 78681
As Javascript has no associative arrays, if you want it that way, you need to use another object.
{id: '#online-order', to: 'contact', colors: { red: '#00F'} }
You can access your red
property like this:
var obj = {id: '#online-order', to: 'contact', colors: { red: '#00F'} };
console.log(obj.colors.red);
//or
console.log(obj['colors']['red']);
Upvotes: 3