Question: I have a very simple list, 2 columns actually. "Name" and "Table".

Its for users to reserve a table at an event. "Name" is free text and "Table" is a selection drop down

There are obviously a limited number of seats on each table and I would like to limit the reservation to 10 per table. Trouble is I don't know how! :-)

Answer: 
Try using **commonModalDialogClose**.

Create function to close popup or directly call method.

```
function CloseDlg() {
   SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.Cancel);
}

```

Or try to hide using class.

```
$('.CloseSPPopUp').click(function(){
   window.top.CloseSPUIPopoup();
});

function CloseSPUIPopoup{
   $(".ms-dlgContent").hide();
}

```

Use **dialogReturnValueCallback** option

```
var options = SP.UI.$create_DialogOptions();
    options.url = '/_layouts/mySolution/myPage.aspx';
    options.width = 500;
    options.height = 400;
    options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
    SP.UI.ModalDialog.showModalDialog(options);

function CloseCallback(result, target) {
    //Your code
}

```
Once I closed my modal in the following way

```
var closeLoading = function() {
    SP.SOD.executeFunc('sp.js', 'SP.ClientContext', function() {
        SP.UI.ModalDialog.commonModalDialogClose(1, 1);
    });
};

```

So write the following line of code in your button click handler.

```
SP.UI.ModalDialog.commonModalDialogClose(1, 1);

```