[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread ajpiano
$(".is_preferred_email").each(function() { $(this).attr("checked","checked"); }); On Oct 6, 8:14 pm, Dave Methvin <[EMAIL PROTECTED]> wrote: > > Actually, I tried both of those things first - should have mentioned > > that.  It was only after I got three elements doing > > alert($j(".is_preferred

[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread Dave Methvin
> Actually, I tried both of those things first - should have mentioned > that.  It was only after I got three elements doing > alert($j(".is_preferred_email")) that I switched to using the index. Looking at your markup, it seems like it should return three elements. I don't see a problem there.

[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread MorningZ
As for yout ".size()" issue this code http://paste.pocoo.org/show/87223/ works totally as expected. not sure what you have different On Oct 6, 10:41 am, BB <[EMAIL PROTECTED]> wrote: > Try: >         $j(".is_preferred_email").each( >             function(i) { >                 this.chec

[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread BB
Try: $j(".is_preferred_email").each( function(i) { this.checked = false; } ); or as the posts before: $j(".is_preferred_email").attr("checked", false); On 6 Okt., 16:04, sydneyos <[EMAIL PROTECTED]> wrote: > Thanks for your input.  Here is

[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread sydneyos
Thanks for your input. Here is the relevant HTML (dynamically generated) On Oct 5, 7:22 pm, MorningZ <[EMAIL PROTECTED]> wrote: > There is absolutely no way you have the selector setup correctly > > what is the HTML? > > On Oct 5, 8:53 pm, sydneyos <[EMAIL PROTECTED]> wrote: > > > I ha

[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread sydneyos
Dave, Actually, I tried both of those things first - should have mentioned that. It was only after I got three elements doing alert($j(".is_preferred_email")) that I switched to using the index. On Oct 5, 7:53 pm, Dave Methvin <[EMAIL PROTECTED]> wrote: > >         $j(".is_preferred_email").eac

[jQuery] Re: $().each() only iterates through first item

2008-10-06 Thread Dave Methvin
> $j(".is_preferred_email").each( > function(i) { > this[i].checked = false; > } > ); Inside the function of each(), the first arg is the index in the array. The "this" is the actual DOM element. It looks like you thought it was the original

[jQuery] Re: $().each() only iterates through first item

2008-10-05 Thread MorningZ
There is absolutely no way you have the selector setup correctly what is the HTML? On Oct 5, 8:53 pm, sydneyos <[EMAIL PROTECTED]> wrote: > I have the following expression where is_preferred_email is a class > assigned to three elements in my page: > >         $j(".is_preferred_email").each( >