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.  Is this the case?  Which is
the "best" method - and more importantly, why?

method #1
$('a.c_update').each(function() {
  var $a = $(this);
  var q = $a.attr('id');
  $a.bind("click",function() {doStuff('getitem',q);return
false;});
 });

method #2
$('a.c_update').bind("click",function() {doStuff
('getitem',this.id);return false;});

Thanks,
Bruce

Reply via email to