Pointer Event Disable anchor tag

I have to disable the link on an li but it should not be disabled all events just disable the link and it will be clickable so i can use hide and show menu function on it

#menu-item-747 {
  pointer-events: none;
  cursor: default;
}

I have used jQuery on this li to hide and show other li and on this li a link is used for another page, I just want to disable link and it will be still clickable to run jQuery toggle.

Related posts

1 comment

  1. To disable a link just do

    $('#menu-item-747 a').click(function(e){
         e.preventDefault();
    });
    

    This won’t prevent other actions, just the default one of the link element (i.e. following the link).

Comments are closed.