Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML jQuery
Hi,
I have a li list on my page like
<ul class="menu">
        <li><a  class="active" href="#about">About Me</a></li>
        <li><a href="#portfolio">My Portfolio</a></li>
        <li><a href="#contact">Contact Me</a></li>
      </ul>
and i want to change it class "active" which is present on my style.css file.
I use a jquiry
$('li').click(function () {
		    $(this).addClass('active').siblings().removeClass('active');
  //              $('li').removeClass();
  //             $(this).parent().addClass('active');
            });
 
but when i use this code then each tyme page was refress and go to the other page by 'a' tag where the css is not change.
how do i solve this problem.Please help me.
Thanks,
Manojit
Posted 14-Jan-13 19:51pm
Edited 14-Jan-13 23:54pm
v3
Comments
Manojit Mondal at 15-Jan-13 2:42am
   
Yes......

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Quote:
but when i use this code then each tyme page was refress and go to the other page where the css is not change.

Of course, dynamically set css properties are not persisted between calls.
So you either use HTML5 local storage[^] (if there is any), or you have to persist these changes on server side too: you can use an ajax call, to pass this change to the server, where it could be stored in a session variable for example.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 620
1 Maciej Los 610
2 CPallini 255
3 RyanDev 161
4 Peter Leow 125
0 OriginalGriff 5,784
1 Sergey Alexandrovich Kryukov 4,838
2 Peter Leow 3,009
3 Maciej Los 2,894
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 15 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100