简体   繁体   English

字形的引导样式为按钮

[英]Bootstrap styling of glyph as a button

I'm building a page with a series of inputs. 我正在建立一个包含一系列输入的页面。 One of them is a select list of email addresses. 其中之一是电子邮件地址的选择列表。 I'm including a Plus glyph at the right end of the list as a button to invoke some javascript that will add additional select lists for more recipients. 我在列表的右端包括一个Plus字形,作为调用一些JavaScript的按钮,这些JavaScript将为更多收件人添加其他选择列表。

I've spent quite a bit of time trying to do this without the results I was hoping for. 我花了很多时间尝试执行此操作,而没有获得希望的结果。 The best I can do is this code example. 我能做的最好的就是这个代码示例。 If you click directly on the plus, you get the result. 如果直接单击加号,则会得到结果。 However, I wish that the entire square surrounding the glyph was clickable instead - not unlike a button. 但是,我希望围绕该字形的整个正方形都可以单击,而不是单击按钮。 Any suggestions? 有什么建议么? Thank you! 谢谢!

<div class="form-group">
  <label for='the_user_email' class='col-sm-2 control-label' style='padding-right: 0px;'>Requested By</label>
  <div class='col-sm-6'>
    <div class="input-group" id="add_emails_event">
      <select class='form-control' name='the_user_email' id='the_user_email'>
        <option value='user1@domain.com'>user1@domain.com
        <option value='user2@domain.com'>user2@domain.com
      </select>
      <span class="input-group-addon"><a onclick="add_email();"><span class="glyphicon glyphicon-plus"></span></a></span>
    </div>
  </div>
</div>

You can solve this by using a button. 您可以使用按钮解决此问题。

    <div class="form-group">
  <label for='the_user_email' class='col-sm-2 control-label' style='padding-right: 0px;'>Requested By</label>
  <div class='col-sm-6'>
    <div class="input-group" id="add_emails_event">
      <select class='form-control' name='the_user_email' id='the_user_email'>
        <option value='user1@domain.com'>user1@domain.com
        <option value='user2@domain.com'>user2@domain.com
      </select>
      <span class="input-group-btn"><button onclick="add_email();" class="btn btn-default"><span class="glyphicon glyphicon-plus"></span></button></span>
    </div>
  </div>
</div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM