?
Solved

How do I align the Delete button all the way to the left and leave the other buttons where they are on the right?

Posted on 2010-09-01
6
Medium Priority
?
506 Views
Last Modified: 2012-05-10
This is my Modal jQuery code.

right now the buttons are aligned on the right side one after the other.
How do I align the Delete button all the way to the left and leave the others where they are on the right?


$( function() {
   $('#ModalForm').dialog(
   {
        modal : true ,
	height: 300,
	width: 500,
        autoOpen : false ,
        buttons  : {
            Delete : function() {
                deleteAnswer();
            } ,
            Cancel : function() {
                closeForm();
            } ,
            Submit : function() {
                addAnswer();
            } 
        }
   });
});

Open in new window

0
Comment
Question by:bcarlis
[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
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
SRigney earned 500 total points
ID: 33578651
This was a fun one to solve.

I had to add the following CSS after the included jquery ui css

            .ui-button{ float: right }
            .ui-dialog-buttonset { float: none; width : 100%}
            .floatleft { float: left }


Then the dialog is defined as

          $('.demo').dialog(
         {
              modal : true ,
                              height: 300,
                              width: 500,
              autoOpen : true ,
              buttons  : {
                  Delete : function() {
                      deleteAnswer();
                  } ,
                  Cancel : function() {
                      closeForm();
                  } ,
                  Submit : function() {
                      addAnswer();
                  }
              },
              open: function(event, ui) {
                    $(this).parent().find("button:contains(Delete)").addClass("floatleft");
              }
         });


By changing how the float right works you may have to change the order you add your buttons to the dialog in order to get them in the order you want them.  Float rights will work backwards.
0
 
LVL 2

Author Comment

by:bcarlis
ID: 33579336
Where do I add the
            .ui-button{ float: right }
            .ui-dialog-buttonset { float: none; width : 100%}
            .floatleft { float: left }

Do I add it in style tags?

<style>
            .ui-button{ float: right }
            .ui-dialog-buttonset { float: none; width : 100%}
            .floatleft { float: left }
</style>

0
 
LVL 2

Author Comment

by:bcarlis
ID: 33579582
This is what I did from your post and it is not working: (I get no errors either)



<script src="/i/libraries/jquery-ui/1.8/ui/minified/jquery-ui-1.8.custom.min.js" type="text/javascript"></script>

<link rel="stylesheet" href = "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/
redmond/jquery-ui.css" type="text/css" />

<style>
    .ui-button{ float: right }
    .ui-dialog-buttonset { float: none; width : 100%}
    .floatleft { float: left }
</style>

<script type="text/javascript">
var htmldb_delete_message='Would you like to perform this delete action?';
$( function() {
   $('#ModalForm').dialog(
   {
        modal : true ,
      height: 300,
      width: 500,
        autoOpen : false ,
        buttons  : {
            Cancel : function() {
                closeForm();
            } ,
            Submit : function() {
                addAnswer();
            } ,
            Delete : function() {
                deleteAnswer();
            }
        },
        open: function(event, ui) {
         $(this).parent().find("button:contains(Delete)").addClass("floatleft");
        }
   });
});
function openForm(pAnswerID){
   // Prepopulate form using AJAX
    ........................
    ........................
    ........................

  // Open the Form
  $('#ModalForm').dialog('open');
}

0
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!

 
LVL 15

Expert Comment

by:SRigney
ID: 33579685
I built that with jQuery UI.1.8.4.css

It looks like the css applied changed between 1.7 and 1.8
0
 
LVL 15

Assisted Solution

by:SRigney
SRigney earned 500 total points
ID: 33579747
http://jqueryui.com/docs/Upgrade_Guide_184

The upgrade guide talks about changes to the buttons in the dialog between 1.7 and 1.8

you should use the same version of CSS and you have for the jQuery UI javascript.
0
 
LVL 2

Author Closing Comment

by:bcarlis
ID: 33607988
Thank you! That should do it..
0

Featured Post

Industry Leaders: 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

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
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 …
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Suggested Courses

765 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