$('#dialog h3.modal-title').html("Corte de caja"); // Render the edit form $('.modal-body').html('<%= j render("cash_outs/get_open_cash_registers") %>'); // Show the dynamic dialog $('#dialog').modal("show"); // Set focus to the first element $('#dialog').on('shown.bs.modal', function () { $('.first_input').focus() })