Bootstrap:在输入中使glyphicon可点击

时间:2016-04-04 15:34:35

标签: html twitter-bootstrap

我有以下代码产生这个:enter image description here

 <div class='input-group manualInput'>
       <input id='address-input' type='text'  class='form-control' placeholder='Enter your current location!'/>
       <span class='input-group-addon'>
          <i class='glyphicon glyphicon-search'></i>
       </span>
  </div>

如何使glyphicon可点击?并调用JS函数

2 个答案:

答案 0 :(得分:5)

像这样添加JavaScript onClick事件:

<span class='input-group-addon'>
    <i class='glyphicon glyphicon-search' onclick="myfunction();"></i>
</span>

答案 1 :(得分:1)

关闭他们的网站:

<div class="input-group">
    <input type="text" class="form-control" placeholder="Search for...">
    <span class="input-group-btn">
        <button class="btn btn-default" type="button">Go!</button>
    </span>
</div><!-- /input-group -->