Set A:Visited Style with JavaScript or Jquery

Set a:visited style with JavaScript or jQuery

Style properties adjust style attributes which apply to elements, they completely replace selectors

You have two choices.

  • Write your rule-sets in advance, and then design the element to match the selector.

e.g.

.foo:visited {
color: #f00;
}

document.getElementById('a12').className += ' foo';
  • Dynamically generate rule-sets with selectors that match the element.

See bobince's answer at Setting CSS pseudo-class rules from JavaScript

How to set link visited color in JQuery

There isn't a visited selector in jQuery that I am aware, but a similar question points to a plugin to handle this Remy Sharp Visited Plugin

Setting visited on link in jQuery

Well, since you did return false, it hasn't been visited. The best you could probably do is style it.

$(this).addClass('visited');

css

.visited {
color: purple;
}


Related Topics



Leave a reply



Submit