Read the online a lot about the jquery $ (this) explanation, the feeling is very vague.
Let me say my own understanding.
This represents the current object, as shown in the example below.
[JavaScript]View PlainCopy
- <! DOCTYPE html>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" >
- </script>
- <script>
- $ (document). Ready (function () {
- $ ("P"). Click (function () {
- $ (this). Hide (); //$ (this) is within the method click, where $ (this) represents the object that is currently calling the click Method ("P"), which is the object that represents the current object, which is currently called by the method
- });
- });
- </script>
- <body>
- <p> If you click on me, I will disappear. </p>
- <p> Click me and I'll disappear. </p>
- <p> also want to click on me Oh. </p>
- </body>
If my thoughts are wrong, you are welcome to criticize me.
A word to tell you what jquery $ (this) exactly refers to, how to use