角色= QUOT按钮"对于< a href

问题描述:

您好我想知道引导程序如何将role =button添加到href链接。

Hi I would like to know how bootstrap can add role="button" to there a href link.

<a href="" role="button">

我无法在css中的任何位置看到角色按钮

I can not see the role button anywhere in the css

我正在尝试制作自己的版本。

I am trying to make my own version.

你究竟想要链接/按钮做什么?

What exactly do you want the link/button to do?

如果您只是将链接样式化为引导按钮,您可以将按钮类添加到它:

If you are just looking at styling the link to look like a bootstrap button you can just add the button classes to it:

<a href="#" class="btn btn-primary">A Link</a>

如果您希望它像按钮一样工作(即提交表单或其他东西),那么您需要javascript或jQuery会更好:

if you want it to function like a button (ie submit a form or something) then you will need javascript or jQuery would be better in order to do that:

    <a href="#" id="myButton">A Link</a>
    <script>
    $(document).ready(function(){
        $("#myButton").click(function(){
            $("#myFormID").submit();
        }); 
    });
    </script>

然后,只需将两者结合起来,锚点链接就会出现,并像按钮一样。

Then just combine the two and the anchor link will appear and act like a button.