javascript - jquery 星级评定在 bootstrap 弹出窗口中不起作用

标签 javascript jquery html css twitter-bootstrap

我在 Bootstrap 弹出窗口中遇到一些问题。 jquery 是否加载到 bootstrap popover 中?

这不起作用。

fiddle - http://jsfiddle.net/mVSPR/5/

// make popovers work
$("a[data-toggle=popover]")
.popover()
.click(function (e) {
  e.preventDefault()
});
$('.add-action>.trigger').popover({ 
      html: true,
      placement: 'bottom',
      content: function() {
        return $(this).parent().find('.add-review-form').html();
      }
  });
$('.add-action>.trigger').popover(function (e) {
    $('.rate').rateit();
  });

我面临的问题是 jquery 星级评定在 bootstrap popover 中不起作用,而在 popover 之外工作得很好。

帮助我。

最佳答案

原因是,你的代码:

  content: function() {
    return $(this).parent().find('.add-review-form').html();
  }

提供 $('.add-review-form') 的副本, Bootstrap 用此副本填充弹出窗口,但事件监听器未复制,因此您需要绑定(bind)复制的 $('.add-review-形式')再次评价它。这是jsfiddle modified :

$('.add-action>.trigger').popover({
    html: true,
    placement: 'bottom',
    content: function () {
        return $(this).parent().find('.add-review-form').html();
    }
}).click(function () {
    $('.rateit-popover').rateit();
});

关于javascript - jquery 星级评定在 bootstrap 弹出窗口中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22854236/

相关文章:

html - 对齐响应式 div

javascript - 传单上可点击的 L.control

javascript - AngularJS 指令用 ng-click 替换文本

javascript - 导航栏在 jQuery 中无法正常工作

javascript - 获取加载到 <div> 容器中的页面的链接

php - 阻止机器人填写 Aweber 表单

javascript - 向左和向右动画 ui ul - 不是圆形

javascript - IE6 Ajax 与 JQuery

php - 在 php 中检索 window.location.hash url

javascript - 使用坐标在 Google map 中创建边界区域