Click here to Skip to main content
15,889,909 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
Hello ,
My Dialog is not working. when i click on button, nothing happens.THis is the code that i am using

CSS
function openPop(url, divClass, title, width, height,btnOk) {
                var b = [];
                if (btnOk) {
                    b = [
        {
            text: "OK",
            click: function () { jQuery("." + divClass).dialog('destroy'); }
        }
        ];
                }
                var ifr = jQuery("." + divClass).find('iframe');

                jQuery("." + divClass).dialog({
                    modal: true,
                    autoOpen: true,
                    title: title,
                    width: width,
                    height: height,
                    resizable: false,
                    position: {
                        my: "center",
                        at: "center",
                        of: window,
                        within: window
                    },
                    buttons: b,
                    open: function () {
                        setTimeout(function () {
                            jQuery(ifr).attr('src', url);
                        }, 10);
                    },
                    close: function () {
                        jQuery(ifr).attr('src', 'about:blank');
                        jQuery(this).dialog('destroy');
                    }

                });
            }


this is how i call this function

$(".btn").click(function () {
              openPop('<%= Request.ApplicationPath%>/StoreManagement/AddNew.aspx', 'divPop', 'Add New Store', 650, 550);
              return false;
          });


whenever i click the button only page blurs for a moment and then returns to it's original state. This code works fine with jquery 1.6.something. now i am trying to use it with jquery 2.1.something but not working here.
Posted
Updated 5-Jan-16 18:24pm
v2
Comments
ZurdoDev 5-Jan-16 8:58am    
I'd suggest using the developer tools in the browser to see what is happening. For example, in Chrome press F12 and pay attention to what is displayed in the console for any error messages.
Riya-Pandey 6-Jan-16 0:11am    
I have tried that. Console doesn't shows any error. I am using firebug
ZurdoDev 6-Jan-16 7:03am    
You'll still need to debug it.
Sergey Alexandrovich Kryukov 5-Jan-16 13:56pm    
...With Chrome, you also can do step-by-step debugging with breakpoints, and inspect any variable/object. There are other JavaScript debuggers...
—SA

1 solution

Make sure to include the latest jquery-ui

Also, the function name is openPopUp but the click is calling openPop

HTML
<script type="text/javascript" src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css">



Here is the demo:
jQuery Dialog - JSFiddle[^]
 
Share this answer
 
Comments
Riya-Pandey 6-Jan-16 0:25am    
Did that. Result is the same. :'(
Bryian Tan 6-Jan-16 9:15am    
did the demo work on your machine?
Riya-Pandey 11-Jan-16 2:31am    
Yup It worked . i have now made it to work. Thank you Briyan

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900