Thank you david,
but i cannot base my selection on the text/html of the element.
I only put it in the sample to make things a bit clear.
What if i added a class to the span to be selected
ex:
<span class="myclass">first</span>
....
<span class="myclass">second</span>
?
DavidIcreate wrote:
>
>
>
> $('div').each(function(){
> var text = $(this).text();
> $('span').each(function(){
> if(text == $(this).text()){
> alert('found '+text);
> }
> });
> });
>
> This code will not get you the subsequent siblings but it will get you
> the span with the same content as the div.
> If you want the subsequent sibling you should somehow retrieve the
> position of the div in the dom and start the search for the span from
> there, but i don't know if it's possible.
>
> I hope this can set you on your way.
>
>
> -- David
>
> ronnie98 schreef:
>> Hi all,
>> i have troubles with subsequent siblings selection.
>> Provided the following code:
>> ########################
>> ..................
>> <span>foo</span>
>> <span>foo</span>
>> <div>first</div>
>> <span></span>
>> <span></span>
>> <span>first</span>
>> <span></span>
>> <span></span>
>> <div>second</div>
>> <span></span>
>> <span></span>
>> <span></span>
>> <span>second</span>
>> <span>foo</span>
>> <span>foo</span>
>> <span>foo</span>
>> <span>foo</span>
>> ...................................
>> #######################
>>
>> my goal is, for each "div", selecting the corresponding subsequent "span"
>> so
>> that
>> first/first and second/second
>> So far i've come with this (not so much)
>>
>> ######################
>>
>> $("div").each(function(i){
>> this......?????
>> });
>>
>> #####################
>>
>> thanks in advance,ronnie
>>
>
>
> --
> David Duymelinck
> ________________
> [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/Selecting-subsequent-siblings-tf4367784s15494.html#a12457614
Sent from the JQuery mailing list archive at Nabble.com.