Solved

Jquery dialog buttons problem

Posted on 2012-12-27
6
346 Views
Last Modified: 2012-12-29
Hello experts.
Using the code below i get only the disable button.
Any help?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="jquery-ui-1.8.18.custom.css">
<script type="text/javascript" language="javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<script type="text/javascript">
var opendialog = function(){
var p = $("#popuploader");
var end = 'End';
var disable = 'Disable';
p.dialog({
        autoOpen: false,
        bgiframe: true,
        show: "clip",
        hide: "explode",
        title: disable,
        resizable: false,
        modal: true,
        width: 400,
        height: 400
    });
p.dialog("option", "buttons", [{
        text: end, click: function () {},
        text: disable, click: function () {}
    }]).dialog("open");
}
</script>
</head>

<body>
<a href="" onclick="opendialog();return false">Open</a>
<div id="popuploader">
</div>
</body>
</html>

Open in new window

0
Comment
Question by:Panos
  • 3
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 38729433
Hmm, I have only seen buttons defined like


buttons: {
        'Delete': function() {
            /* Do stuff */
            $(this).dialog('close');
        },
        Cancel: function() {
            $(this).dialog('close');
        }
    },

in the dialog code

Looking around on the web, I think you want

p.dialog("option", "buttons", {
        'end': function () {},
        'disable': function () {}
    }).dialog("open");
}
0
 
LVL 2

Author Comment

by:Panos
ID: 38729443
Hi
Take a look here:
http://api.jqueryui.com/dialog/
under buttons
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 38729450
See my update.

You will need to quote the text unless end and disable are vars:


p.dialog("option", "buttons", [
       {text:'end', click: function () {} },
        {text:'disable', click: function () {}}
      ]).dialog("open");
}
0
 
LVL 2

Author Comment

by:Panos
ID: 38729515
Yes. It is working.
The problem was to put each "text:'end', click: function () {}" inside {  ... }
Thank you
0
 
LVL 2

Author Closing Comment

by:Panos
ID: 38729516
Thank you
regards
panos
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
converting document.write() to innerHTML 7 54
Jquery 7 34
javascript form - error when hitting enter 3 28
Put javascript to get dropdown value 3 22
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to count occurrences of each item in an array.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question