我正在使用自定义jQuery 1.10.3主题.我从主题滚筒直接下载,我故意没有改变任何东西.
我创建了一个对话框,我得到一个空的灰色方块,其中关闭图标应为:

我比较了在我的页面上生成的代码:
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<spanid="ui-id-2" class="ui-dialog-title">Title</span>
<button class="ui-dialog-titlebar-close"></button>
</div>
Run Code Online (Sandbox Code Playgroud)
在Dialog Demo页面上生成的代码:
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<span id="ui-id-1" class="ui-dialog-title">Basic dialog</span>
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close" role="button" aria-disabled="false" title="close">
<span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span>
<span class="ui-button-text">close</span>
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
编辑:代码的不同部分是由jQueryUI 生成的,而不是我,所以我不能只是添加span标签而不编辑jqueryui js文件,这似乎是一个糟糕/不必要的选择,以实现正常的功能.
以下是用于生成代码部分的javascript:
this.element.dialog({
appendTo: "#summary_container",
title: this.title(),
closeText: "Close",
width: this.width,
position: {
my: "center top",
at: ("center top+"+(window.innerHeight*.1)),
collision: "none"
},
modal: false,
resizable: false,
draggable: false,
show: "fold",
hide: "fold", …Run Code Online (Sandbox Code Playgroud) 当我尝试在bootstrap.js中运行我的Web应用程序时,出现以下错误:
localhost中第1306行第7行的未处理异常:7904/Scripts/bootstrap.js 0x800a139e - JavaScript运行时错误:
selector在window.document对象上初始化工具提示时必须指定选项!
这是它所指的以下代码行:
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
//LINE 1306 IS RIGHT HERE
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
} …Run Code Online (Sandbox Code Playgroud)