Reputation: 125
this is an active link
<a href="#" class="btn btn-large">Link</a>
how to disable this link using javascript, so the code would be like this?
<a href="#" class="btn btn-large disabled">Link</a>
Upvotes: 10
Views: 56215
Reputation: 1
Use the attribute disabled
in a class, like class="btn btn-danger disabled"
For example:
<a href="exampleLink.php?id=3&option=1" class="btn btn-danger disabled" role="button">Cancelar</a>
Upvotes: -2
Reputation: 24276
HTML
<a href="#" id="myLink" class="btn btn-large">Link</a>
Pure JS
var d = document.getElementById("myLink");
d.className = d.className + " disabled";
jQuery
$('#myLink').addClass('disabled');
Upvotes: 18