<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>George</title> <link href="styles.css" rel="stylesheet" type="text/css"> <link type="text/css" href="css/flick/jquery-ui-1.8.16.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script> </head> <div class="openD">Open Dialog</div <div id="dialog"> test</div> </body> <script type="text/javascript"> $(document).ready(function(){ $(function(){ $(«#dialog»).dialog({ autoOpen: false, modal: true, buttons: { «Да» }, «Нет»: function(){$(this).dialog(«close»);}} }); $(«.openD»).click(function(){ $(«#dialog»).dialog(«open»); }); }); }); </script> </body> </html> 

What is wrong here?

    1 answer 1

    1. Quotes must be normal "
    2. After yes, remove the right brace }
    3. The "Yes" button, you also need to assign something.

    In general, here is the working code:

     $(document).ready(function(){ $("#dialog").dialog({ autoOpen: false, modal: true, buttons: {"Да":"", "Нет": function(){ $(this).dialog("close") }} }); $(".openD").click(function(){ $("#dialog").dialog("open"); }); }); 
    • do not tell me why enclose the code in this design? <pre> $ (function () {...}); </ pre> - Specter
    • Yes, you are right, once - more. Fixed - DemoS
    • @Demos and single quotes abnormal chtol? ^^ - Zowie
    • Single - normal, and the side - no. - DemoS
    • > do not tell me why enclose the code in this design? $ (function () {...}); This short record is equivalent to $(document).ready(handler) , it describes the function that will be called when the DOM is fully loaded. Read more about the function in [documentation] [1]. [1]: api.jquery.com/ready - l0ki