I am looping over an object and trying to add an onclick event for each button that corresponds to each item in the object.
for id of obj
button = $("#my_button"+ id)
button.click(-> console.log id)
With this loop, every button logs the last id of the loop. How do I get each button to log the proper corresponding id?