横向和替换课程
我希望替换父( li.filetabs
)元素的子元素( ul
)的类名。 我所做的似乎很正确,但显然不是因为class级没有被替换。
使用JSFIDDLE更新Jsfiddle的注意事项:当您单击一次时,一切正常,再次单击相同的导航选项卡,您会看到下拉消失并重新出现…
var aFileTabs = $('.filetabs'); var curTab = $(this); // this seems to give correct output var prevCurTab = $('.cTabActive').parent(); //(ie *jQuery(li.filetabs)* ) // the following line is the problem line; Ive tried replacing the children with // $('ul',prevCurTab)... but that doesnt work either... I must be doing something // very basic wrong $(prevCurTab).children().removeClass('cTabActive').addClass('cPrevTabActive'); $('ul', curTab).addClass ('cTabActive');
编辑:道歉,我忘了HTML,还有更多,所以只有前两个导航按钮html被显示以获得意义。