I quickly wrote this jquery plugin. When I pass it a $element it slides up, but then it breaks on this.empty() claiming this is not a function. What's the problemo?
(function ( $ ) {
$.fn.slideUpEmpty = function(t, callback){
this.slideUp(t, function(){
this.empty();
if(callback){
callback();
}
});
}
}( jQuery ));
Use
$('#somediv').slideUpEmpty(500, function(){
});
thisrefers to the jQuery object. Inside a jQuery method callback,thisrefers to the DOM element.