【问题标题】:JQuery UI Dialgo modal's title html tags is not rendered未呈现 JQuery UI 对话框模式标题 html 标记
【发布时间】:2017-12-06 07:33:15
【问题描述】:

我目前正在向我的应用程序添加模态。当模态显示时,它还会在模态标题中显示 html 标签。

如您所见,对话框标题未呈现,而是显示 html 标记。这里是对话框 html

<div id="dialog_simple" title="Dialog Simple Title">
  <p>
   Dialog part is woring just fine.
  </p>

</div>

这里有相关的javascript来打开模态

$('#dialog_link').click(function() {
        $('#dialog_simple').dialog('open');
        return false;
  });


 $('#dialog_simple').dialog({
          autoOpen : false,
          width : 600,
          resizable : false,
          modal : true,
          title : "<div class='widget-header'><h4><i class='fa fa-warning'></i> Empty the recycle bin?</h4></div>",
          buttons : [{
            html : "<i class='fa fa-trash-o'></i>&nbsp; Delete all items",
            "class" : "btn btn-danger",
            click : function() {
              $(this).dialog("close");
            }
          }, {
            html : "<i class='fa fa-times'></i>&nbsp; Cancel",
            "class" : "btn btn-default",
            click : function() {
              $(this).dialog("close");
            }
          }]
        });

        })

我错过了什么吗?在此先感谢

【问题讨论】:

  • 看起来你正在用你自己的包装 Bootstrap 的 Modal 插件。确保 title 没有将其视为纯文本而是 HTML。

标签: javascript html css jquery-ui-dialog


【解决方案1】:

看起来这与 Bootstrap 无关。 据我所知,您正在使用 jQuery UI Dialog (http://jqueryui.com/dialog/),对吗?

title 属性只接受字符串,但您可以覆盖默认行为,如下所示:https://stackoverflow.com/a/14488776/3215856

【讨论】:

  • @HarunErgül 你应该在你的帖子中提到这一点。这是重要的信息。
  • 其实你这么一说我就明白了
  • @HarunErgül 这甚至与前端无关。你有一个问题,你想解决它。如果您不知道答案,您可以在互联网上针对特定问题询问特定主题。不要感到羞耻,如果它们更明确,它只会让事情变得更容易:) 你能否也请更新标题和标签。我建议完全删除“Bootstrap”这个词,并用“jQuery UI Dialog”替换它
  • @marcobiedermann 我正在开发一个基于 Django 的 CRUD 应用程序。这是一个个人项目。我正在尝试一起提高我的前端和后端技能。感谢反馈
猜你喜欢
  • 2018-10-06
  • 1970-01-01
  • 1970-01-01
  • 2013-08-19
  • 2011-05-05
  • 2011-08-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多