Keep menu item disabled

0

How to keep a menu item temporarily disabled on the site?

<li><a href='cadastrar.php'>CADASTRAR</a></li>

Thank you.

    
asked by anonymous 26.05.2018 / 16:20

2 answers

0

You can disable the default action by JavaScript .

With jQuery:

$("a[href='cadastrar.php']").click(function (e) {
    e.preventDefault();
});

With native JavaScript:

var el = document.querySelectorAll("a[href='cadastrar.php']");

el[0].addEventListener("click", function(e){
    e.preventDefault();
});
    
26.05.2018 / 17:37
-1

You can do this with css and leaving no link within the href:

.link{
cursor:auto;
}
<li><a class="link" href='#'>CADASTRAR</a></li>
    
26.05.2018 / 16:53