Solved

Jquery dialog buttons problem

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

746 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

13 Experts available now in Live!

Get 1:1 Help Now