How can I position buttons from jQuery UI separately from each other. Buttons are aligned in same direction. I would like one button to be aligned to left while the other to the right. Is it possible?
+5
A:
OK, looking at this through Firebug...
The Dialog control create a div with a class called ui-dialog-buttonpane
, so you can search for that.
If you are dealing with multiple buttons, you will probably want :first
and :last
attributes.
So, $(".ui-dialog-buttonpane button:first)
should get you the first button.
and $(".ui-dialog-buttonpane button:last)
should get you the last button.
From there you can modify the css/style to put each button on the right and left (modify the float values).
Anyway, that is how I would approach it right now.
Chris Brandsma
2009-06-07 00:20:27
Exactly! So simple...
turezky
2009-06-07 20:26:00
This doesn't work if you have multiple dialogs.
Brian C. Lane
2009-06-27 04:43:25
Then expand the selectors a bit. $("div.dialog < .ui-dialog-buttonpane button:last) and $(""div.dialog < .ui-dialog-buttonpane button:first) should work. The div.dialog should be the owner of the dialog in the first place.
Chris Brandsma
2009-06-27 16:07:53
A:
you could also add class to your dialog (http://docs.jquery.com/UI/Dialog#option-dialogClass) to localize your styling.
pashcan
2009-10-28 21:20:32