By default, the jQuery-UI dialog will place buttons on the right side of the popup:
This causes a problem because if you have “OK” right next to “Delete”, and you click the wrong one, well …
The obvious solution is to move the “Delete” to the opposite side.
To do that, add the following two lines after creating the dialog:
Now the buttons are on opposite sides: