Skip to content Skip to sidebar Skip to footer

Looping Through An Array And Setting Variables

What I have so far: http://codepen.io/anon/pen/umHzl?editors=101 You notice that you can click a box and unclick it. What I would like is that when a certain button is clicked all

Solution 1:

It's not e1, it's el (lowercase 'L'). And you'll still want to use the attr() function, e.g.:

for (var i =0; i < 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

Post a Comment for "Looping Through An Array And Setting Variables"