I am writing several jQuery codes as shown below:
$('.button').each(function(){
$(this).click(function(){
console.log($(this));
do_sth();
});
});
var do_sth = function(){
console.log($(this));
}
I want the console.log results to be the same, but it doesnβt work correctly ... The first relates to HTMLElement, and the second refers to DOMWindow ... How can I rewrite the do_sth function so that they all refer to HTMLElement? Thank.
source
share