发现在js和jquery中设置a链接不可用的方式是不一样的。
在js中,要这样:
firstPage.removeAttribute("href");
firstPage.setAttribute("disabled", "disabled");
而在jquery中,要这样:
currentSelectReleaseBtn.removeAttr('href');
currentSelectReleaseBtn.attr("disabled", true);
本文探讨了在JavaScript和jQuery中如何使a链接失效。在JS中使用removeAttribute和setAttribute方法,在jQuery中使用removeAttr和attr方法。两种方式各有特点,适用于不同场景。
发现在js和jquery中设置a链接不可用的方式是不一样的。
在js中,要这样:
firstPage.removeAttribute("href");
firstPage.setAttribute("disabled", "disabled");
而在jquery中,要这样:
currentSelectReleaseBtn.removeAttr('href');
currentSelectReleaseBtn.attr("disabled", true);

被折叠的 条评论
为什么被折叠?