Search code examples
jquerygreasemonkey

JQuery get class of clicked item when using delegate


What I'm trying to do is the following: The user clicks on an link with the id "overlay_table_overzicht_a", and the class "500|500".

I capture that click with the following jquery line:

$(document).delegate('#overlay_table_overzicht_a', 'click', go_to_elsewhere_on_map);

As you can see, is this triggerd by the ID overlay_table_overzicht_a. But i wan't to pass the CLASS of the clicked item to the function go_to_elsewhere_on_map.

So how do i capture the CLASS of the clicked item, and pass it to the function?


Solution

  • $(document).delegate('#overlay_table_overzicht_a', 'click', function() {
        go_to_elsewhere_on_map($(this).attr('class'));
    });