If I would have a simple function like this:

jQuery.fn.example = function(){

and call it with an empty selector:


What element would then this be pointing to? Or is there a way to make a function able to be executed through both $.example(), without a selector, and with $(something).example()? If so, how can I find out which way the function has been executed so I can have different actions depending way of execution?

Basically, "this" refers to the selected element you have chosen to remove. Let's say, if you have called the .example() function like ( $("a").example(); ), "this" will refer to all link elements in your page. So basically, I think you don't have to call the $.example() function if you are not pertaining to any particular element.

What I meant was what would happen if a script dependent of a selector would be called without a selector used, what would then be automatically selected? The jQuery object or the document object perhaps? Do you understand my question?

Yeah, I do understand your question. That's a good question, but I never encountered that kind of situation yet so basically, I don't have any idea about it.

Ok :) thanks anyway, if you ever find out, let me know will you?