I have a bunch of buttons, and use the following to assign click events.

             $(".button").each( function() {
                 var data = { check_dirty: 1 };
                 data.action = $(this).text().toLowerCase();
                 if (data.action == 'save') data.check_dirty = 0;

                 $(this).css("text-align", "center");
                 $(this).bind( "click", data, check_save);
             });


The problem is that all the click handlers get the data that is assign 
by the last button processed. If I set through firebug, they are all 
getting assigned the correct values as the each loop is executing, but 
data seems to be global rather then scoped to the anon function!

What am I missing here?

-Steve

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to