I am new to jQuery. I am creating an asp.net MVC application.
I am displaying a dialog when user clicks on a button using the following code.
$(document).ready(function () {
$dialog = $("#quantityDialog").dialog({
autoOpen: false,
title: 'Add to Cart',
});
$('.AddToCart').on('click', function () {
$dialog.dialog('open');
});
});
HTML:
<div id="quantityDialog" style="display:none">
...
</div>
The dialog is working fine.
- I need to restrict the user from being able to click other elements of the page when the dialog is being displayed.
- Also when the user clicks elsewhere (outside the dialog box) the dialog has to be closed.
How can I achieve this. Help me out.
modal: true