角色= QUOT按钮"对于< a href [英] role="button" for <a href

查看:84
本文介绍了角色= 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.

这篇关于角色= QUOT按钮&QUOT;对于&lt; a href的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆