javascript - Looping through an array and setting variables -


what have far:

http://codepen.io/anon/pen/umhzl?editors=101

you notice can click box , unclick it. when button clicked other buttons unclicked(turn normal color).

my attempt @ this:

        (var =0; < booths.length; i++){                 var obj = booths[i]                 obj.e1['fill'] = obj['color'];                 obj.e1['checked'] = 'false';                 $("#"+obj.name).remove();             } 

i know color in e1/rectangle object of box, not know how change/access variable. says obj.e1 undefined. if obj['fill'] still doesn't work.

how change colors such loop (or similar).

it's not e1, it's el (lowercase 'l'). , you'll still want use attr() function, e.g.:

for (var =0; < booths.length; i++){   var obj = booths[i]   obj.el.attr('fill', obj['color']);   obj.el.attr('checked', 'false');   $("#"+obj.name).remove(); } 

example: http://codepen.io/paulroub/pen/yfwcq


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -