【发布时间】:2012-01-30 19:15:08
【问题描述】:
我想在 jQuery 对话框的按钮之间添加一些自定义 HTML(特别是包含单词“或”的跨度)。
我的 Javascript 是这样的:
$("#foo").dialog({
autoOpen: false,
width: 600,
modal: true,
resizable: false,
buttons: {
save: { text: 'Save', class: 'form-finish form-submit', click: function() {
…
}
},
cancel: { text: 'Cancel', class: 'form-cancel', click: function() {
$( this ).dialog( "close" );
}
}
}
});
它生成的 HTML 是这样的:
<button class="form-finish form-submit ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false"><span class="ui-button-text">Save</span></button>
<button class="close cancel ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false"><span class="ui-button-text">Cancel</span></button>
我想要的是这个:
<button class="form-finish form-submit ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false"><span class="ui-button-text">Save</span></button>
<span class="article">or</span>
<button class="close cancel ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false"><span class="ui-button-text">Cancel</span></button>
有什么方法可以在不破解 jQuery UI 核心的情况下做到这一点?谢谢!
【问题讨论】:
标签: jquery jquery-ui dialog jquery-ui-dialog customization