如何在点击按钮后隐藏被访问的链接? [英] How to hide visited links after a click to button?

查看:335
本文介绍了如何在点击按钮后隐藏被访问的链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网页上有一个链接列表,其中一些链接已经被我访问过了。我必须使它们在任何操作后(看检查复选框,单击按钮等)不可见。



我试图使用jQuery: $(a:visited)。hide(300);

UPD :所以,方案是:



1)用户点击按钮;



2)所有访问的链接都会消失。



jsFiddle示例

解决方案

确定,请尝试此css文件中的

  .foo a:visited {
display:none;
}

pre> $('button')。on('click',function(e){
$('ul')。addClass('foo');
})


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

解决方案

ok, so try this

in your css file

.foo a:visited{
    display:none;
}

in your javascript

$('button').on('click', function(e){
    $('ul').addClass('foo');
})

这篇关于如何在点击按钮后隐藏被访问的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆