New to Kendo UI for jQuery? Download free 30-day trial

Add Close Buttons inside Modal Windows

Environment

Product Progress® Kendo UI® Window for jQuery
Operating System Windows 10 64bit
Visual Studio Version Visual Studio 2017
Preferred Language JavaScript

Description

How can I add a Close button to a modal Kendo UI Window?

Solution

The example below demonstrates how to achieve the desired scenario.

    <div id="window">
      <button id="close">Close</button>
    </div>
    <button id="open">Open window</button>
    <script>
      $(document).ready(function() {
        var wnd = $("#window");
        $("#open").kendoButton({
          click:function(){
            wnd.data("kendoWindow").open();
            $("#open").hide();
          }
        })
        $("#close").kendoButton({
          click:function(){
            $("[data-role=window]").data("kendoWindow").close();
          }
        })
        if (!wnd.data("kendoWindow")) {
          wnd.kendoWindow({
            modal: true,
            title: "Dialog window",
            close: function() {
              $("#open").show();
            },
            visible: false
          });
        }
      });
    </script>

See Also

In this article