View Full Version : how to access parent functions variables

07-05-2010, 08:14 AM
function note(x,y,who)
this.x = x
this.y = y
this.who = who
this.timeout = null

$('#notex').fadeIn(200, function() { alert(this.x); }
this.timeout = SetTimtout( function() { alert(this.who); } );

var sa = new note(50,50,'notex')


I am trying to create a simple class in which i want to sent the id of a div to fade in and fade out...
so that i can dynamically change its color width and height with a basic class.

I read about closures but inside jquery this is referring the div notex....

how to access parent functions variables?

07-05-2010, 08:37 AM
You spelled settimeout wrong and you never close your fadeIn call. Simple javascript debugging will catch this.