 <p>This is normal behaviour. The Javascript context is specific to a page. If you reload the page, even if some of the HTML markup is the same, its Javascript-set attributes will be reset.</p> <p>You can achieve persistent element highlighting using cookies or server-side code (sessions).</p> <p>You can set a cookie <a href="http://www.electrictoolbox.com/jquery-cookies/" rel="nofollow">like this</a>, if you use the <a href="https://github.com/carhartl/jquery-cookie" rel="nofollow">jquery-cookie plugin</a> :</p> <pre><code> $("#nav-container&gt;li").click(function(){ $(this).addClass('selected') .siblings() .removeClass('selected'); $.cookie("selected", $(this).attr('id'), { path: '/' }) }); $(document).ready(function() { $("#" + $.cookie("selected")).addClass('selected') }); </code></pre> <p>Note: didn't test this code, but it should work. Of course, the user needs to have cookies enabled to use this.</p>