When you run the following code:
$("button").on("click", function(){
console.log("Meu valor é: " + $(this).val());
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><buttonvalue="1">Clique-me</button>
The value of the button is returned normally. But in:
$("button").on("click", ()=>{
console.log("Meu valor é " +$(this).val());
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><buttonvalue="1">Clique-me</button>
Using arrow function in the event acknowledges the error in jQuery:
Uncaught TypeError: Can not read property 'toLowerCase' of undefined
Notice that I'm using the latest version% of jQuery%.
Someone would know why the arrow function does not work in jQuery event cases since ES6 is not something so new (also called ECMAScript 2015) released at June of 2015 (almost 3 years!)?