Inside the $.each callback function, 'this' holds a reference to each
iterating/ed element (in your example, the dd). See
http://docs.jquery.com/Core/each#callback for more info. So, you can do

$(this).find("input")
-or-
$("input", this)

One other thing you might do is change

$.each($("dd"),function(i) {
to
$("dd").each(function(i) {

The $.each method (
http://docs.jquery.com/Utilities/jQuery.each#objectcallback ) is great for
iterating through arbitrary objects and arrays, but since you've got a
jQuery object, you can call the each method on it instead.

- Richard

On 10/16/07, didats triadi <[EMAIL PROTECTED]> wrote:
>
> I'm quite new in JQuery.
>
> If I have a HTML structure like this:
> <dl>
>
> <dt><label>abc</label></dt>
> <dd><input type="text" name="text" />
> <span>this is text</span></dd>
>
> <dt><label>abc</label></dt>
> <dd><input type="text" name="text" />
> <span>this is text</span></dd>
>
> </dl>
>
> I want to get the input and span object. Actually, I can do that
> separately. But I think there is a simple way. And I have no idea about
> that.
>
> $.each($("dd"),function(i) {
> // i'm stuck here. if i'm using $("dd input") it will get all the input
> tags.
> // I just want the input tag on each iteration.
> });
>
> Thanks in advance.
> Didats.
>

Reply via email to