?
Solved

Jquery dialog buttons problem

Posted on 2012-12-27
6
Medium Priority
?
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

650 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