Home › Forums › JavaScript › $(this) from within a seperately called function › Re: $(this) from within a seperately called function
January 17, 2013 at 2:04 pm
#121286
__
Participant
You might find [this](http://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/) interesting.
IIUC, `this` inside `removeBtn` would be “undefined” (or, in most browsers, would fall back to `[object Window]`).
To make your example work:
$(“.save”).click( function(){
removeBtn( this );
});
function removeBtn( context ){
$(context).remove();
}