Force JQuery Dialog Title to Multiple Lines

泪湿孤枕 提交于 2019-12-01 11:58:30
James

I ended up using the answer of this question (thanks @jazZRo): Using HTML in a Dialog's title in jQuery UI 1.10 to extend the widget.

I then set my title as follows: (Working example: http://jsfiddle.net/VKcJ7/30/)

JS:

$(document).ready(function () {
    $('#dialog').dialog({
        autoOpen: false,
        modal: true,
        title: 'SOME ITEM <br> Remaining Qty (Cts.): 0'
        //adding the newline character \n is ignored...
    });
});

Officially, I don't think you can.

The hacky way is to jam it in:

$("#dialog")
    .dialog({
      autoOpen: false
    })
    .closest(".ui-dialog")
      .find(".ui-dialog-title")
        .html("Dialog<br>Title");

Live Example | With resizable: true

But again, fairly hacky.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!