twitter-bootstrap 引导程序:无法/禁用 <a> 使用 javascript 的链接引导程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17610282/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bootstrap : unable/disable <a> link bootstrap using javascript
提问by ocit
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?
如何使用javascript禁用此链接,因此代码将是这样的?
<a href="#" class="btn btn-large disabled">Link</a>
回答by Mihai Matei
HTML
HTML
<a href="#" id="myLink" class="btn btn-large">Link</a>
Pure JS
纯JS
var d = document.getElementById("myLink");
d.className = d.className + " disabled";
jQuery
jQuery
$('#myLink').addClass('disabled');
回答by John Doe
Use the attribute disabledin a class, like class="btn btn-danger disabled"
disabled在类中使用该属性,例如class="btn btn-danger disabled"
For example:
例如:
<a href="exampleLink.php?id=3&option=1" class="btn btn-danger disabled" role="button">Cancelar</a>
<a href="exampleLink.php?id=3&option=1" class="btn btn-danger disabled" role="button">Cancelar</a>

