I would be inclined to argue that you should allow the link to remain active, even when on the selected page. This is so you can allow the user to explicitely refresh their view of the data you're displaying when they desire. The link should be highlighted to indicate that this is the currently selected page.
Otherwise if you don't want your user refreshing the page, you should remove the link (or <li />
or whatever) completely so that in the context of the application,the notion of refreshing the page doesn't exist, instead of indicating the currently selected page by a disabled link, use an explicit heading.
To achieve this result, you could use the following:
$("#menu").find('*[href]').each(function(index) {
if ($(this).attr("href") == window.location.pathname) {
$(this).parents("li").html("");
}
});
If you need to keep the element visible, just remove the href:
$("#menu").find('*[href]').each(function(index) {
if ($(this).attr("href") == window.location.pathname) {
$(this).removeAttr("href");
}
});
but I'd also modify the style so it doesn't just look like a broken link or something.