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