2014-09-04 81 views
1

我试图实现bootstrap的typeahead,但我试图让一个按钮被点击时在弹出窗口上显示输入栏。Bootstrap type in a popover

在弹出窗口内有很多功能。

<div id="popover-button-container"> 
    <button id="popover-button" type="button" class="btn btn-default" 
      data-toggle="popover" 
      data-placement="left">${entries.size() - 4} more</button> 
      <div id="popover-content" class="hide"> 
       <input class="typeahead" type="text" placeholder="Search by Artist Name" /> 
      </div> 
</div> 

添加JS:

<script> 
$("#popover-button").popover({ 
    html:true, 
    content: function(){ 
     return $('#popover-content').html(); 
    } 
})</script> 

的预输入似乎并不在酥料饼的工作不过。如果我删除了class = hide部分,则未隐藏的输入可以工作,但不是弹出窗口中的那个。

想知道是否有人遇到过这种情况?

任何帮助将是伟大的!

+0

请向我们展示您的JS – Devin 2014-09-04 22:00:12

+0

添加了js for popover – 1000Suns 2014-09-04 22:10:36

回答

0

你尝试过吗?

// Constructs the suggestion engine 
// Typehead codes here 

$('#myPopover').on('show.bs.popover', function() { 

    // Initialize your typehead script 
    typehead.initilize(); 

    // Followed by your Typehead codes here... 

}) 
+0

嘿,对不起!我会试试这个,并给你一个更新。没有时间今天:( – 1000Suns 2014-09-05 21:14:10