Excellent ! That is the answer !
Thanks a mill !
Chris
Karl Swedberg-2 wrote:
>
> Hi Chris,
>
> When you chain jQuery methods to "this", you need to encapsulate
> "this" in the jQuery constructor -- $(). Try it this way, and see if
> it works:
>
> $(".MyButton").each(function(){
>
> $(this).click(function(){ alert(this.id;) });
>
> });
>
>
> --Karl
> _________________
> Karl Swedberg
> www.englishrules.com
> www.learningjquery.com
>
>
>
> On Feb 15, 2007, at 8:14 AM, Mahadewa wrote:
>
>>
>> Hi all,
>>
>> I have a question about .each construct. I have the following
>> snippet code,
>> but for some reason it doesn't do what I expected it to do. Have I
>> missed
>> something ?
>>
>> $(".MyButton").each(function(){
>>
>> this.click(function(){ alert(this.id;) });
>>
>> });
>>
>> Thanks for the help,
>> Chris
>> --
>> View this message in context: http://www.nabble.com/Question-
>> about-.each%28%29-tf3233682.html#a8985143
>> Sent from the JQuery mailing list archive at Nabble.com.
>>
>>
>> _______________________________________________
>> jQuery mailing list
>> [email protected]
>> http://jquery.com/discuss/
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/Question-about-.each%28%29-tf3233682.html#a8985371
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/