Unable to addclass to an active sub li in Jquery accordion
I am using Jquery Accordion with a UL contained within each section and I cant figure out how to add a class to indicate the active link.
I have searched my head-off but the only thing I can find doesnt work with the Acco开发者_开发知识库rdion:
$(document).ready(function(){
var path = location.pathname.substring(1);
if ( path )
$('#accordion1 a[href$="' + path + '"]').attr('class', 'activelink');
});
Please help, as I am premeturely going bald!
Why not use addClass
?
$('#accordion1 a[href$="' + path + '"]').addClass('activelink');
精彩评论