ocit
ocit

Reputation: 125

bootstrap : unable/disable <a> link bootstrap using javascript

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

Answers (2)

John Doe
John Doe

Reputation: 1

Use the attribute disabled in a class, like class="btn btn-danger disabled"

For example:

<a href="exampleLink.php?id=3&amp;option=1" class="btn btn-danger disabled" role="button">Cancelar</a>

Upvotes: -2

Mihai Matei
Mihai Matei

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

Related Questions