where does $(this) point to , under the following circumstances .
Given the following code INSIDE A PLUGIN , where exactly is $(this) pointing to ??
EXMPLE ONE :
var current = $(this); // declared as a global variable inside a plugin. EXAMPLE TWO
- function number_of_image(){
- $(current).each(function(){
- count++;
- });
- return count;
- };
EXAMPLE TWO :
- function number_of_image(){
- $(this).each(function(){
- count++;
-
- });
-
- return count;
- };
EXAMPLE THREE : (This is not a function , this snippet of code is typed in the global scope of the plugin) :
- var count = 0;
- $(this).each(function(){
- count++;
- });
now given that i call the plugin this way :
- $('img').pluginname();
what does the $(this) point to ? (i actually want $(this) to point to the current selected element , which in this case is $('img')).
Thank you .
Gautam .