This is a keyword in the JavaScript language. It represents an internal object that is automatically generated when the function is run, this represents the current object and can only be used inside the function
var that=this is a copy of the current this object into that variable
$ (' #conten'). Click (function () { //This is the #conten var that is clicked this; $ ('. Conten'). each (function () { //-This is the current object in the. Conten loop //that is still just clicked on #conten });
As you can see, the This object is changed at any time in the program, and after Var that=this, that is still pointing to the then-current this, so that no previous object can be found
jquery jquery has a particularly typical example of what it means to use _this.
$ ("#btn"). Click (function () { varthis; here This and _this both represent the "#btn" of this object $ (". TR"). each (function () { this; // here This represents each of the ". Tr" Objects that are traversed _this; // still stands for "#btn" Object })})
This is the case in a code fragment where this may represent a different object, and the coder wants _this to represent the original object
JS can be nested multiple layers of code, perhaps the following can also be embedded in a method, reference this will become the sub-method control of the object, if the need for superior image,
In the absence of parameters, the preceding premise made a temporary variable _this, you can save the ancestor to the image, the child method can be called with _this, this is the purpose.
JS Common var that = the use of this