hi guys, I am doing some tests on e.currentTarget vs $(this) to get things clear in my head. It is said that the two are equivalent, so I created a test page with the following code in (among the other things of course):
<div class="testLink">
<a href="#">Link</a>
</div>
The script goes:
/*TESTS ON THE TESTLINK*/
$(".testLink").click(function(e){
e.preventDefault();
console.log("e.currentTarget is " + e.currentTarget);
console.log("this is " + $(this).html());
});
/*EN OF TESTS ON THE TESTLINK*/
And this is the result I get:
e.currentTarget is [object HTMLDivElement]
this is <a href="#">Link</a>
Now, first of all I would like to ask, how do I actually print the value of e.currentTarget to obtain an HTML tag as I did for $(this).html())?
Second - but perhaps more importantly - to me the results do not coincide: e.currentTarget seems to be returning the DIV containing the link and $(this) returns instead the expected result. Can anybody clarify please?
thanks