views:

41

answers:

1
$(document).ready(function() {

            function GetDeals() {
                alert($(this).attr("id"));
            }

            $('.filterResult').live("click", function(event) {
                GetDeals();
            });

        });

What do I need to pass as argument in function GetDeals() so that I can manipulate with $(this)?

Thanks in advance!

+4  A: 

You could just use the function as your event handle:

$('.filterResult').live("click", GetDeals);

(please note, you don't use the () to call the function, so the function itself is being passed to the live() function, not its result.

Or you can use Function.prototype.apply()

$('.filterResult').live("click", function(event) {
  GetDeals.apply(this);
});
gnarf
thanks, both solutions work :)
ile