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
IE8 Alternative to Window.Scrolly
How to Disable JavaScript Function Calls from the Browser Console
Good Beginners Tutorial to Socket.Io
Cross Browser Rgba Transparent Background While Keeping Content (Text & Images) Non-Transparent
Javascript, CSS: Get Element by Style Attribute
Wrap Text Inside Fixed Div with CSS or JavaScript
Bootstrap 3 Compatible with Current Angularjs Bootstrap Directives
Bootstrap Datepicker Orientation/Placement
How to Disable JavaScript for Responsive Design
Jquery: Animate Margins to Auto
Play Pause HTML5 Video JavaScript
Jquery Click Event Not Firing on the Element Created Dynamically Using Jquery
Choosing Mobile Web HTML5 Framework
How to Make a Div Always Float on the Screen in Top Right Corner
How to Properly Escape Attribute Values in CSS/Js Attribute Selector [Attr=Value]
Using Media Queries to Only Include Js Files on Mobile