使用引导弹出式回调

编程入门 行业动态 更新时间:2024-10-26 04:31:06
本文介绍了使用引导弹出式回调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前正在使用引导程序弹出窗口向表单添加一些其他字段。要设置选择框的格式,我需要利用popover回调,但是似乎无法启动该回调。如果您更喜欢使用jsfiddle,请在此处查看。感谢您的任何建议。

I'm currently using bootstrap popovers to add some additional fields to my form. To format my select boxes, I need to take advantage of the popover callback, however I seem to be unable to get the callback to fire. If you prefer to use jsfiddle, check it out here. Thanks for any suggestions.

$("[data-toggle=popover]").popover({ html: true, content: function() { return $('#popover-content').html(); }, showCallback: function() { alert('called back'); } });

.container { padding: 20px; } .form-control { width: 120px; } .popover { max-width: 400px; }

<script src="ajax.googleapis/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="netdna.bootstrapcdn/bootstrap/3.1.1/js/bootstrap.min.js"></script> <link href="netdna.bootstrapcdn/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" /> <div class="container"> <h3>Bootstrap 3 Popover HTML Example</h3> <ul class="list-unstyled"> <li><a data-placement="bottom" data-toggle="popover" data-container="body" data-placement="left" type="button" data-html="true" href="#" id="login"><span class="glyphicon glyphicon-search" style="margin:3px 0 0 0"></span></a> </li> <div id="popover-content" class="hide"> <form class="form-inline" role="form"> <div class="form-group"> <h1>My content</h1> </div> </form> </div> </ul> </div>

推荐答案

没有弹出选项 showCallback ,而是尝试使用弹出事件

There is no popover option showCallback instead try using one of Bootstraps built in popover events

例如,当显示弹出窗口时触发警报,您​​可以这样做

So for example triggering the alert when the popover is shown you would do this

$("[data-toggle=popover]").on('shown.bs.popover', function () { alert('called back'); });

我更新了您的 JS小提琴为例...

I updated your JS Fiddle for an example...

更多推荐

使用引导弹出式回调

本文发布于:2023-08-06 04:48:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310166.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出式   回调

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!