0

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.

Here is the fiddle - 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);  
});
Carter Steinhoff
  • 41
  • 1
  • 1
  • 9
  • Possible duplicate of [Disabled href tag](http://stackoverflow.com/questions/13955667/disabled-href-tag) – Scott Sep 14 '16 at 00:33

1 Answers1

0

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...

Scott
  • 21,475
  • 8
  • 43
  • 55