【问题标题】:Bootstrap typeahead in a popover在弹出窗口中引导输入
【发布时间】:2014-09-04 21:53:15
【问题描述】:

我正在尝试实现引导程序的预输入,但我试图在单击按钮时让输入栏出现在弹出窗口中。

在弹出框内几乎有预输入功能。

<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 部分,则未隐藏的输入有效,但弹出窗口中的输入无效。

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

任何帮助都会很棒!

【问题讨论】:

  • 请给我们看看你的JS
  • 添加了popover的js

标签: javascript jquery twitter-bootstrap-3 typeahead.js


【解决方案1】:

你试过了吗?

// 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...

})

【讨论】:

  • 嘿抱歉!我会试试这个并给你一个更新。今天没时间 :(
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-07-17
  • 2014-05-04
  • 2020-08-17
  • 2020-07-07
  • 2021-03-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多