Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 425
ocit Avatar asked Jul 12 '13 08:07

ocit


1 Answers

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');
like image 184
Mihai Matei Avatar answered Sep 29 '22 19:09

Mihai Matei