Bug Tracker

Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#166 closed bug (invalid)

nth-of-type

Reported by: anonymous Owned by:
Priority: major Milestone:
Component: ajax Version:
Keywords: nth-of-type problem Cc:
Blocked by: Blocking:

Description

I have this function:

function menu_bar() {

var url = document.location.href; var parametro = url.substring(url.indexOf('?')+1,url.length); var arrayParams=parametro.split('&');

for (var i=0;i<arrayParams.length;i++){

if (arrayParams[i].substring(0,arrayParams[i].indexOf('=')) == 'categoria') {

var numBer = (arrayParams[i].substring(arrayParams[i].indexOf('=')+1,arrayParams[i].length)-1); $("#navigation-continguts ul.small-menu>li:nth-of-type('"+numBer+"')").find("h2").addClass("on"); $("#navigation-continguts ul.small-menu>li:nth-of-type('"+numBer+"')").find("div.menu_go_button").addClass("on");

}

}

}

and the followin' html code:

<div id="navigation-continguts">

<ul class="small-menu">

<li>

<div class="box-container">

<div class="box-title">

<h2>Documentos</h2> <div class="menu_go_button off"></div><a href="?categoria=1">Documentos</a>

</div>

</div>

</li>

</ul></div>

Note that there are 4 <li>s inside the UL

So the problem is that I cant set the class to the H2 and div.menu_go_button

if im using the old version of jquery, i mean differetn than 1.0 or 1.01 everything is workin correctly, but the problem is that im using prototype too in the same document and its messign' somethin', so i chaneged to jquery 1.01 and now i cant get applied these classes.

if there soem problem workin with nth-of-type ?

Donno if my explication is good, but i would liek u to help me

Change History (1)

comment:1 Changed 17 years ago by john

Resolution: invalid
Status: newclosed
Version: 1.0b1

nth-of-type was removed from jQuery in 1.0. I recommend that you try nth-child, which (according to your example) will suit you just fine.

Note: See TracTickets for help on using tickets.