Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery UI add id to dialog

Tags:

css

jquery-ui

How can I add id to specific dialog? I just want to apply separate style for each dialog and try doing it like this:

var $order_dialog = $("<%= escape_javascript(render('order_mini_site_form', :layout => false)) %>");

var current_dialog = $order_dialog.dialog({
  width: 515,
  height: 575,
  modal: true,
  resizable: false,
  draggable: false,
  title: false,
  autoOpen: true,
  closeOnEscape: false,
  buttons: [
    { text: "Отправить запрос" , click: function() { $(this).find('form').submit();    $(this).dialog('close'); } },
    { text: "Отмена", click: function() { $(this).dialog('close'); } }
  ]
}).parent().find('.ui-dialog-titlebar').remove();


$current_dialog.attr('id', 'awesome_dialog');

but dialog created inside body tag without id and I cant apply style for it.

like image 416
Vladimir Avatar asked Jul 03 '12 10:07

Vladimir


1 Answers

A bit late, but this is how it could be done:

$('#placeholderId').dialog('widget').attr('id', 'dialogId');

$('#placeholderId').dialog('widget') gives you the surrounding <div> of the dialog, which is most likely the element you want to set the ID on.

like image 194
Andreas Avatar answered Nov 06 '22 08:11

Andreas