Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional jQuery
BOOK: Professional jQuery
This is the forum to discuss the Wrox book Professional jQuery Cesar Otero, Rob Larsen; ISBN: 978-1-1180-2668-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional jQuery section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 6th, 2012, 12:39 PM
Authorized User
Join Date: Mar 2011
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to preserve link state or CSS class on a link (anchor tag) with cookies?


I have this piece of code which adds and remove a class on my links.
The class is added to the linked clicked or active and removed from liked that are not active/clicked.

However I would like to preserve the state of the link so that it remain active, this is for a single page.


$(document).ready(function() {	
    $('.navbar li a').click(function(){
        $(".navbar li a").removeClass("currentTab");

<style type="text/css">
color: #999999;

<ul class="navbar">
<li><a href="#/">Test Link</a></li>
<li><a href="#/">Test Link</a></li>
<li><a href="#/">Test Link</a></li>
Thanks everyone!


Similar Threads
Thread Thread Starter Forum Replies Last Post
anchor link not working in IE6 sbkumar CSS Cascading Style Sheets 2 July 29th, 2008 11:27 AM
Anchor tag visited CSS related question mat41 Classic ASP Basics 0 April 16th, 2008 05:55 PM
link to anchor in a db-generated page scottiegirl PHP Databases 4 March 11th, 2008 12:19 PM
div tag as link Stagmo Dreamweaver (all versions) 0 April 14th, 2006 12:35 AM
Help with paginating and anchor link. major dynamic123 Pro PHP 6 September 11th, 2003 01:47 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.