2

There are a list of links on a page and some of them are already visited by me. I have to make them invisible after any action(checking a checkbox, clicking button, etc).

I tried to use jQuery: $("a:visited").hide(300); but it doesn't seem to work.

UPD: So, the scenario is:

1) the user clicks a button;

2) all the visited links disappear.

jsFiddle example

Vlad Holubiev
  • 4,876
  • 7
  • 44
  • 59
  • possible duplicate of [Use jQuery to Select Visited Links](http://stackoverflow.com/questions/1210871/use-jquery-to-select-visited-links) – rid Sep 25 '13 at 20:05
  • 2
    Not possible: https://hacks.mozilla.org/2010/03/privacy-related-changes-coming-to-css-vistited/ – andi Sep 25 '13 at 21:04
  • @andi, But what about such a hack: after a click to any link on a page it is pushed to an array which is stored using WebStorage. And when user clicks to button, script hide all links from the array. Is it possible to do such a way? – Vlad Holubiev Sep 25 '13 at 21:33
  • 1
    You mean only hide the links that the user clicked while he was on that page? That should be ok. If you're not trying to manipulate visited links which the user visited before he came to your page, then you won't bump into that security issue. Another possibility, depending on your needs: you are allowed to change the color of visited links, so maybe you could "hide" them by setting them to the same color as the background. – andi Sep 26 '13 at 14:01

2 Answers2

3

You can try full CSS method :

a:visited { display: none; }

Or

a:visited { visibility: hidden; }

Or you can use a plugin method : Visited Plugin by Remy Sharp

Usage in jQuery :

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

With CSS :

.visited { display: none; }

Or

.visited { visibility: hidden; }
deformhead
  • 111
  • 2
3

ok, so try this

in your css file

.foo a:visited{
    display:none;
}

in your javascript

$('button').on('click', function(e){
    $('ul').addClass('foo');
})
jeremy castelli
  • 1,232
  • 10
  • 26