selected class not working jquery function -


the function below show/hides divs tabs can tab between different divs. in addition uses ben alman's bbq plugin http://benalman.com/projects/jquery-bbq-plugin/ allows use button on browser when tabbing between divs.

everything works can't link of clicked tab show 'selected'. when click on tab should add "selected" class link shows selected.

$(function () { var tabcontainers = $('div.tabs > div');   tabcontainers.hide().filter(':first').show();    $(window).bind('hashchange', function () {     var hash = window.location.hash || '#divcontainer';      tabcontainers.hide();     tabcontainers.filter(hash).show();     $('div.tabs ul.tabnavigation a').removeclass('selected');     $('a[hash=' + hash + ']').addclass('selected');   });    $(window).trigger( "hashchange" ); }); 

first save anchor in var @ start of function
var currenct_anchor = $(this);

then

$('div.tabs ul.tabnavigation a').removeclass('selected'); currenct_anchor.addclass('selected'); 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -