Html 在 bootstrap 3 的 popover 中放置一个表单?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18706896/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 13:12:14  来源:igfitidea点击:

place a form within popover in bootstrap 3?

htmltwitter-bootstrap

提问by Rahul

How to place a form within popover in bootstrap 3?

如何在bootstrap 3的popover中放置表单?

<a href="#" class="btn btn-lg btn-danger" data-toggle="popover" title="" data-content="And here's some amazing content. It's very engaging. right?" data-original-title="A Title">Click It !</a>

it gives a effect like :

它产生如下效果:

pic

图片

I want to place a form within its body. How can we do it ?

我想在它的身体内放置一个表格。我们怎么做?

回答by Ajay

$('#popover').popover({ 
    html : true,
    title: function() {
      return $("#popover-head").html();
    },
    content: function() {
      return $("#popover-content").html();
    }
});

Popover HTML Markup:

弹出 HTML 标记:

<a href="#" id="popover">the popover link</a>
<div id="popover-head" class="hide">some title</div>
<div id="popover-content" class="hide">
  <form>
    <!-- my form -->
  </form>
</div>

回答by Zulu

I add content on popover like this:

我在 popover 上添加内容是这样的:

$('#your-poped').popover({
  content: '<div id="preview"></div>',
  html: true,
  trigger: 'manual',
  delay: {'show':1000, 'hide':250},
});
$('#preview').html(yourdata);