Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make jQuery dialog modal?

I am using jQuery dialog in asp.net. It is working fine for me. The problem is when I open the dialog box, I can still work parent page functionality. I don't want that. Just dialog to modal and should not allow focus on parent page.

window.onload = function onloadFunction() {

        //setup edit person dialog
     $('#uploadPic').dialog({
             autoOpen: false,
             draggable: true,
             title: "Upload Picture",
             open: function(type, data) {
                 $(this).parent().appendTo("form");
             }
         });
     }

Is there any way to make it modal? Or if lost focus on dialog box close it automatically?

Please help me out.

like image 669
James123 Avatar asked Oct 15 '10 18:10

James123


1 Answers

Use

$('#uploadPic').dialog({
         autoOpen: false,
         modal: true,
         draggable: true,
         title: "Upload Picture",
         open: function(type, data) {
             $(this).parent().appendTo("form");
         }
     });
 }

I have just added the modal option to your sample.

like image 64
Lorenzo Avatar answered Nov 15 '22 21:11

Lorenzo