# Add Close Buttons inside Modal Windows

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Progress® Kendo UI® Window for jQuery</td>
 </tr>
 <tr>
  <td>Operating System</td>
  <td>Windows 10 64bit</td>
 </tr>
 <tr>
  <td>Visual Studio Version</td>
  <td>Visual Studio 2017</td>
 </tr>
 <tr>
  <td>Preferred Language</td>
  <td>JavaScript</td>
 </tr>
</table>

## 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.

```dojo
    <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

* [JavaScript API Reference of the Kendo UI for jQuery Window](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/window)
* [Post to Iframes in the Window](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/post-to-iframe)
* [Restrict Window Positioning](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/restrict-windows-position)
* [Use Custom Action Icons in the Window](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/use-custom-action-icons)
