jQuery href属性没有被禁用 [英] Jquery href attribute not getting disabled
问题描述
使用Jquery满足条件后,我似乎无法实现正确的语法和/或逻辑来删除锚标记.然后,我想在满足其他条件时再次启用它.我当前的逻辑有缺陷,无法正常工作.我需要知道是否有一个相对简单的解决方法.否则,我将只使用一个按钮,因此我可以使用当前使用的禁用状态逻辑.如果您有解决办法,请提供小提琴.
I can't seem to implement the correct syntax and/or logic to remove an anchor tag upon a condition being met using Jquery. I then want to enable it again upon another condition being met. My current logic is flawed and doesn't work. I need to know if there is a relatively simple workaround; otherwise, I will just use a button, so I can use the disabled state logic I currently have in place. Please provide fiddle if you have solution.
这是小提琴- https://jsfiddle.net/carbot3000/yoonn2x1/3/
else if ($(".areaall").children().first().index() == $(".areaall .review:visible").first().index()) {
$('.prev').css("color","grey");
$('.prev').attr("disabled",true);
}
$('.next').click(function() {
$('.prev').show();
$('.prev').css("color","#31b2ed");
$('.prev').attr("disabled",false);
rvwList.slice(start, start + x).hide();
start += x;
rvwList.slice(start, start + x).show();
showHide();
console.log('size_li is:' + size_li);
console.log('start is:' + start);
console.log('start is:' + end);
});
推荐答案
定位标记不处于禁用"状态.您只需要取消单击的绑定或更改所应用的CSS以使其显示被禁用...或使用按钮元素而不是锚点...
Anchor tags do not have a "disabled" state. You'll have to just unbind the click or change the CSS applied to make it appear disabled... or use button elements rather than anchors...
这篇关于jQuery href属性没有被禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!