[jQuery] Binding a function to 1 'a' tag - which approach is best?

2009-11-27 Thread Bruce MacKay
Hello folks, I have some html returned via ajax that contains several 'a' tags to which I am binding a function. Both of the following methods does the job, but my perception of other posts about this general practice from more wiser folk than me is that the first method is the better method.

Re: [jQuery] Binding a function to 1 'a' tag - which approach is best?

2009-11-27 Thread Michel Belleville
Now let's try to simplify this a bit : $('a.c_update').each(function() { var $a = $(this); var q = $a.attr('id'); $a.bind(click, function() { doStuff('getitem',q); // hmm, I don't like this variable much... return false; }); }); $('a.c_update').each(function() { var $a = $(this); $a.bind(click,