$(".button").bind( "click", function(){ });
keeps everything associated with each individual button, throwing in a
named function can easily hit some globals!
and what is form_dirty?
let's see the whole page!
On 1/25/07, Stephen Woodbridge <[EMAIL PROTECTED]> wrote:
>
> 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/
>
--
Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/