Inside an event 'this' refers to the element the event was attached to. This is by design. If you want to access the externaly scoped 'this' do something like:
var self=this;
$('#text-field).click( function() { alert(self.name); } );


Blair

On 11/7/06, Steve Reid <[EMAIL PROTECTED]> wrote:
why doesn't this work:
 
$('#text-field').val(this.name);
 
when this does:
 
$('#text-field).click( function() { alert(this.name); } );
 
? did i find a bug?

also: what does 'this' refer to? the jquery object, right?

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to