Solved

Jquery dialog buttons problem

Posted on 2012-12-27
6
341 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now