Why and when would you use $(this) instead of this?
You use this when you are in the scope of a DOM object (or any other object for that matter)
For example:
$('a').click(function(){
var href = $(this).prop('href'); //refers to to this a tags href
var href1 = this.href; //ALSO refers to to this a tags href
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With