/ Published in: jQuery
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
 $('nav a').each(function() { var hreflink = $(this).attr("href"); if (hreflink.toLowerCase()==location.href.toLowerCase()) { $(this).addClass('selected'); } });
Comments
                    Subscribe to comments
                
                