Add Class ONCLICK FOR DISPLAY PURPOSES
by bizamajig
HTML
<a href="">Click me</a>
CSS
a:hover, a.clicked { color: red; }
a { color: black; }
JavaScript
$("a").focus(function() {
$(this).addClass("clicked");
$(this).data("focused", 1);
})
.blur(function() {
if ($(this).data("focused")!=1) {
$(this).removeClass("clicked");
}
})
.click(function() { $(this).addClass("clicked"); return false; });