You may find this sentence in the code written by others: var that = this;, what does this mean?
In JavaScript, this represents the current object.
var that=this copies the current this object into the that variable. What's the point of doing this?
$('#zhetenga').click (function(){
//This is the one that was clicked #zhetenga
var that = this;
$('.zhetenga').each(function(){
//This is. The current object in the zhetenga loop
//that is still the one that was clicked just now #zhetenga
});
});
As you can see, this object is in the program It will change at any time, and after var that=this, that still points to this at that time before it changes, so that the original object will not be found.