I have something like this:
var Something = function(){ this.render = function(){}; $(window).resize(function(){ this.render(); }); }
The solution you found is the the one most people use. The common convention is to call your tempThis variable "that."
var Something = function(){ this.render = function(){}; var that = this; $(window).resize(function(){ that.render(); }); };