相关疑难解决方法(0)

如何仅使用CSS禁用链接?

有没有办法使用CSS禁用链接?

我有一个被调用的类,current-page并希望禁用此类的链接,以便在单击它们时不会发生任何操作.

html css

825
推荐指数
13
解决办法
115万
查看次数

删除href属性

我正在尝试编写分页代码.一个功能是禁用当前链接,使其看起来像文本并且不可点击.在html页面中,这可以通过省略href属性来实现,如:

<a>Link</a>
Run Code Online (Sandbox Code Playgroud)

我不能在javaScript中这样做,

AvdonPagination.prototype.manageLinks = function(link){
    if(link){
        this.current.href = '#';
        this.current = link;
    }else{
        this.current = this.links[0];
    }
    this.current.href = null;
}
Run Code Online (Sandbox Code Playgroud)

因为

this.current.href = null;
Run Code Online (Sandbox Code Playgroud)

产生

<a href="null">Link</a>
Run Code Online (Sandbox Code Playgroud)

我也试过了this.current.href="",this.current.disabled=true但是它们都不起作用.我怎么能实现<a>Link</a>

javascript href hyperlink

8
推荐指数
1
解决办法
3万
查看次数

标签 统计

css ×1

href ×1

html ×1

hyperlink ×1

javascript ×1