> why doesn't this work:
>
> $('#text-field').val(this.name);
What is "this"? You haven't given it a value. So it depends on the context
of this code. If the code is not in an object method, then "this" is the
window object.
> 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?
Now your reference to "this" is inside a function, specifically an event
handler. jQuery follows the same practice as the native DOM: inside an event
handler, "this" is the DOM element associated with the event. That's why you
can do this.name.
-Mike
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/