I've got a code in js/jQuery for an event which is.
function extraAction(data) { console.log(data); }
$('a.edit').on('click', function(e) {
e.preventDefault();
var d = $(this).attr('href');
extraAction(d);
});
The code works just fine. But if I try to declare the function(e)
as (e) =>
instead, I get an undefined
in the console log. Why is that?
It works regardless if I pass a static string like extraAction('hello');