role=“button” for <a href

匿名 (未验证) 提交于 2019-12-03 01:39:01

问题:

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

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

I can not see the role button anywhere in the css

I am trying to make my own version.

回答1:

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>

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.



转载请标明出处:role=“button” for <a href
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!