$('a').each(function() {
if(document.URL.indexOf($(this).attr('href')) >= 0) $(this).addClass('selected');
});
Note: This code will add the 'selected' css class to all <a> tags which link to the current page.
$('a').each(function() {
if(document.URL.indexOf($(this).attr('href')) >= 0) $(this).addClass('selected');
});
Note: This code will add the 'selected' css class to all <a> tags which link to the current page.