Hi.
This shouldn't work at all anyway as you shouldn't have different
elements with the same ID in a document.
Try again giving a different id to your divs and you lis.
Le 25 janv. 07 à 00:52, Klaus Hartl a écrit :
> Repost, didn't came through I guess...
>
> [EMAIL PROTECTED] wrote:
>>
>> Hi,
>>
>> I've been looking for a solution regarding my problem... first, it
>> appears I hadn't the right files when doing my tests with different
>> versions. So it works fine with the packed version 1.0.4 . But
>> when I
>> replace it with the packed v1.1.1, the code
>> alert(' div : '+$("div#tab_0").length+'- li :
>> '+$("li#tab_0").length);
>> doesn't produce the same result.
>> with v1.0.4 : "div : 1 - li : 1"
>> with v1.1.1 : "div : 0 - li : 1"
>>
>> The generated HTML code parsed by Jquery is something like this :
>> <div id="tabview" style="width: 99%;">
>>
>> <ul>
>> <li class="" id="tab_0"><div onclick="showTab(0,'false');"
>> style="cursor: pointer;">Great Clients</div></li>
>> <li class="current" id="tab_1"><div onclick="showTab
>> (1,'false');"
>> style="cursor: pointer;">Good Clients</div></li>
>> <li class="" id="tab_2"><div onclick="showTab(2,'false');"
>> style="cursor: pointer;">Bad Clients</div></li>
>> </ul>
>> <span id="AA_default_loading_div" class="loadingDiv"
>> style="display:
>> none;"> loading... </span>
>> </div>
>>
>>
>> <div id="tab_0" style="display: block; clear: left; width: 99%;">
>> div0
>> </div>
>> <div id="tab_1" style="display: block; clear: left; width: 99%;">
>> div1
>> </div>
>>
>>
>> I really don't understand why the li element matches, but not the div
>> element. Can somebody help me please ?
>>
>> Thanks in advance
>
>
> Vincent,
>
> an id has to be unique in a document, I wouldn't rely on anything with
> invalid HTML.
>
> I assume the following happens: document.getElementById usually
> retrieves the first element with the given id if you have more than
> one
> element with that id. It will never return both by design.
>
> From what I know from discussions about speeding up jQuery 1.1 it
> uses
> getElementById for the selector 'div#id' and then checks if the
> type is
> correct. That means:
>
> $("li#tab_0") and $("div#tab_0") and $("#tab_0") with your HTML
> will all
> first return the following element (which comes first in the source):
>
> <li id="tab_0"></li>
>
> Checking the type now obviously only returns an element for $
> ("li#tab_0").
>
> If you'd use valid HTML you wouldn't have all the problems and jQuery
> cannot be blamed to have a bug here. If you want to differentiate
> elements (that seem to belong to a certain class here) by its type
> in a
> selector use the class attribute.
>
>
> -- Klaus
>
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/