Given the code:
$(element, document).mousedown(function() {
$(this).attr('id'); // get id of the element
});
how to rewrite the code without using this?
what is THIS stands for?
In this context, this points to the element that you are currently defining the mousedown property for.
I can't see a reason not to use it here. Can you elaborate on what you want to do?
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