我正在尝试编写一个分页代码。其中一个函数是禁用当前链接,使其看起来像文本并且无法被点击。在HTML页面中,可以通过省略href属性来实现:
我正試圖編寫一個分頁程式碼。其中一個功能是禁用當前鏈接,使其看起來像文本並且無法被點擊。在HTML頁面中,可以通過省略href屬性來實現:
<a>Link</a>
我无法在JavaScript中做到这一点,
AvdonPagination.prototype.manageLinks = function(link){
if(link){
this.current.href = '#';
this.current = link;
}else{
this.current = this.links[0];
}
this.current.href = null;
}
因为
this.current.href = null;
产生
<a href="null">Link</a>
我也尝试了 this.current.href=""
和 this.current.disabled=true
,但它们都没有起作用。 我该如何实现 <a>链接</a>
?