最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I change the Kendo alert title? - Stack Overflow

programmeradmin2浏览0评论

I'm using a Kendo alert and want to change the title of it. The default title is the url name, see link(image) below. I want to use my own title, how do I change this?

Image Kendo alert

The kendo alert:

kendo.alert("mytext");

I'm using a Kendo alert and want to change the title of it. The default title is the url name, see link(image) below. I want to use my own title, how do I change this?

Image Kendo alert

The kendo alert:

kendo.alert("mytext");
Share Improve this question edited Oct 31, 2018 at 14:53 Rico Koldi asked Oct 26, 2018 at 11:13 Rico KoldiRico Koldi 3862 silver badges11 bronze badges 2
  • use css hide title – Sooriya Dasanayake Commented Oct 26, 2018 at 11:35
  • Thanks for your comment, I already found a solution. See my answer below. – Rico Koldi Commented Oct 29, 2018 at 8:46
Add a comment  | 

3 Answers 3

Reset to default 15

I found a solution to change the title, I did the following:

myalert("mytext"); 

function myalert(content) {
    $("<div></div>").kendoAlert({
        title: "mytitle!",
        content: content
    }).data("kendoAlert").open();
}

Result: Image Kendo alert custom title

I hope this answer helps a lot of people with the same problem.

As Kendo Alert inherits from Kendo Dialog, you can update the title with the title() method:

kendo.alert("Hello!").element.getKendoAlert().title("new title");

https://dojo.telerik.com/EGOKeQAl

You can chain the center() method if the alert is not centered after the title change.

kendo.alert("Hello!").element.getKendoAlert().title("new title").center();

you cannot change the Title it's possible to hide it using css:

.k-dialog .k-window-titlebar .k-dialog-title {
        visibility: hidden;
    }
发布评论

评论列表(0)

  1. 暂无评论