Say we have a simple event button handler:
$( \"#aButton\" ).click(function() {
console.log( \"tile\" + this.val() + \"clicked\" );
});
I re
this
is the raw DOM element. You have to wrap it in a jQuery object if you want to use jQuery functions on it.
console.log( "tile" + $(this).val() + "clicked" );
// ^^^^^^^^^^^^^
Inputs have a property called value
that does the same. So you can use it on raw DOM inputs like this:
console.log( "tile" + this.value + "clicked" );
// ^^^^^^^^^^