According to Typescript’s spec “this” is referring to the instance of class the method belongs to/is called on.
You could use the target attribute of the event object passed to the callback:
class foo {
public test(evt){
alert($(evt.target).data("id")); // "undefined"
console.log($(evt.target));
}
}
Or event.currentTarget depending on if you want to get the element actually clicked on or the element which captured the event.