For instance I have a function:
function somefunction () {
$('someselector').fadeOut('slow', function() { $(this).remove; });
}
Then this function is called within:
$('someselector1').click(function() {
somefunction ();
});
Will the $(this) inside somefunction() refer to someselector() or to someselector1()? As I understand it, this() refers to the selector that triggered the event, which is in this case, someselector1. Is it correct?
It will refer to a DOM element matching
someselector.thisis set to the element thefadeOutfunction is being applied to.thisinside ofsomeFunction(but not inside the callback function tofadeOut) will be a reference to thewindowobject.Example: http://jsfiddle.net/9ubgH/