$('#dialog h3.modal-title').html("Registro de <%= @sale.credit? ? 'abono' : 'pago' %>"); $('#dialog').modal({ closeOnEscape: false }); // Rend$( ".selector" ).dialog({ closeOnEscape: false });er the edit form <% if @sale.saletype == 'credit' %> $('.modal-body').html('<%= j render("cash_registers_moves/abonoform") %>'); <% else %> $('.modal-body').html('<%= j render("cash_registers_moves/form") %>'); <% end %> // Show the dynamic dialog $('#dialog').modal("show"); // Set focus to the first element $('#dialog').on('shown.bs.modal', function () { $('.first_input').focus() })